FIX: maintain category ordering when position is fixed for browsing

FEATURE: allow mods to set category ordering for topic creation dialog
  using fixed_category_positions_on_create
This commit is contained in:
Sam 2015-06-16 09:31:41 +10:00
parent 357d4e3dd3
commit 7b8786e14f
4 changed files with 19 additions and 1 deletions

View file

@ -26,7 +26,11 @@ export default ComboboxView.extend({
}.property('scopedCategoryId', 'categories'), }.property('scopedCategoryId', 'categories'),
_setCategories: function() { _setCategories: function() {
this.set('categories', this.get('categories') || Discourse.Category.list()); this.set('categories', this.get('categories') || (
Discourse.SiteSettings.fixed_category_positions_on_create ?
Discourse.Category.list() : Discourse.Category.listByActivity()
)
);
}.on('init'), }.on('init'),
none: function() { none: function() {

View file

@ -216,6 +216,14 @@ Discourse.Category.reopenClass({
}, },
list: function() { list: function() {
if (Discourse.SiteSettings.fixed_category_positions) {
return Discourse.Site.currentProp('categories');
} else {
return Discourse.Site.currentProp('sortedCategories');
}
},
listByActivity: function() {
return Discourse.Site.currentProp('sortedCategories'); return Discourse.Site.currentProp('sortedCategories');
}, },

View file

@ -768,6 +768,7 @@ en:
category_featured_topics: "Number of topics displayed per category on the /categories page. After changing this value, it takes up to 15 minutes for the categories page to update." category_featured_topics: "Number of topics displayed per category on the /categories page. After changing this value, it takes up to 15 minutes for the categories page to update."
show_subcategory_list: "Show subcategory list instead of topic list when entering a category." show_subcategory_list: "Show subcategory list instead of topic list when entering a category."
fixed_category_positions: "If checked, you will be able to arrange categories into a fixed order. If unchecked, categories are listed in order of activity." fixed_category_positions: "If checked, you will be able to arrange categories into a fixed order. If unchecked, categories are listed in order of activity."
fixed_category_positions_on_create: "If checked, category ordering will be maintained on topic creation dialog (requires fixed_category_positions)."
add_rel_nofollow_to_user_content: "Add rel nofollow to all submitted user content, except for internal links (including parent domains). If you change this, you must rebake all posts with: \"rake posts:rebake\"" add_rel_nofollow_to_user_content: "Add rel nofollow to all submitted user content, except for internal links (including parent domains). If you change this, you must rebake all posts with: \"rake posts:rebake\""
exclude_rel_nofollow_domains: "A list of domains where nofollow should not be added to links. tld.com will automatically allow sub.tld.com as well. As a minimum, you should add the top-level domain of this site to help web crawlers find all content. If other parts of your website are at other domains, add those too." exclude_rel_nofollow_domains: "A list of domains where nofollow should not be added to links. tld.com will automatically allow sub.tld.com as well. As a minimum, you should add the top-level domain of this site to help web crawlers find all content. If other parts of your website are at other domains, add those too."

View file

@ -168,6 +168,11 @@ basic:
fixed_category_positions: fixed_category_positions:
client: true client: true
default: false default: false
fixed_category_positions_on_create:
client: true
default: false
show_subcategory_list: show_subcategory_list:
default: false default: false
client: true client: true