ability to set maximum related topics rendered in ACP

v1.18.x
psychobunny 9 years ago
parent ba719148c1
commit 339b4c30fc

@ -324,7 +324,9 @@ module.exports = function(Topics) {
};
Topics.getRelatedTopics = function(topicData, callback) {
if (!topicData.tags.length) {
var maximumTopics = typeof meta.config.maximumRelatedTopics !== 'undefined' ? parseInt(meta.config.maximumRelatedTopics, 10) : 5;
if (!topicData.tags.length || maximumTopics === 0) {
return callback(null, topicData);
}
@ -353,7 +355,7 @@ module.exports = function(Topics) {
});
}
related = _.shuffle(related).slice(0, 5);
related = _.shuffle(related).slice(0, maximumTopics);
topicData.related = related;
callback(err, topicData);

@ -31,4 +31,15 @@
</div>
</div>
<div class="row">
<div class="col-sm-2 col-xs-12 settings-header">Related Topics</div>
<div class="col-sm-10 col-xs-12">
<form>
<div class="form-group">
<label for="maximumRelatedTopics">Maximum related topics to display (if supported by theme)</label>
<input id="maximumRelatedTopics" type="text" class="form-control" value="5" data-field="maximumRelatedTopics">
</div>
</div>
</div>
<!-- IMPORT admin/settings/footer.tpl -->
Loading…
Cancel
Save