mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: each category can control how many topics to show on categories page
This commit is contained in:
@@ -70,7 +70,7 @@ const Category = RestModel.extend({
|
||||
|
||||
@computed("topic_count")
|
||||
moreTopics(topicCount) {
|
||||
return topicCount > Discourse.SiteSettings.category_featured_topics;
|
||||
return topicCount > (this.get('num_featured_topics') || 2);
|
||||
},
|
||||
|
||||
save() {
|
||||
@@ -103,7 +103,8 @@ const Category = RestModel.extend({
|
||||
sort_order: this.get('sort_order'),
|
||||
sort_ascending: this.get('sort_ascending'),
|
||||
topic_featured_link_allowed: this.get('topic_featured_link_allowed'),
|
||||
show_subcategory_list: this.get('show_subcategory_list')
|
||||
show_subcategory_list: this.get('show_subcategory_list'),
|
||||
num_featured_topics: this.get('num_featured_topics')
|
||||
},
|
||||
type: id ? 'PUT' : 'POST'
|
||||
});
|
||||
@@ -149,7 +150,7 @@ const Category = RestModel.extend({
|
||||
@computed("topics")
|
||||
featuredTopics(topics) {
|
||||
if (topics && topics.length) {
|
||||
return topics.slice(0, Discourse.SiteSettings.category_featured_topics || 2);
|
||||
return topics.slice(0, this.get('num_featured_topics') || 2);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -75,8 +75,17 @@
|
||||
{{plugin-outlet name="category-email-in" args=(hash category=category)}}
|
||||
{{/if}}
|
||||
|
||||
{{#unless category.parent_category_id}}
|
||||
<section class="field num-featured-topics-fields">
|
||||
<label>
|
||||
{{i18n "category.num_featured_topics"}}
|
||||
{{text-field value=category.num_featured_topics}}
|
||||
</label>
|
||||
</section>
|
||||
{{/unless}}
|
||||
|
||||
{{#if showPositionInput}}
|
||||
<section class='field'>
|
||||
<section class='field position-fields'>
|
||||
<label>
|
||||
{{i18n 'category.position'}}
|
||||
{{text-field value=category.position class="position-input"}}
|
||||
|
||||
Reference in New Issue
Block a user