From 68fcb6644368d0c87c8ccdf5be1e74a67bf808aa Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 16 May 2014 15:27:42 -0400 Subject: [PATCH] Use Discourse.computed.setting for more better javascript --- .../discourse/controllers/discovery/categories.js.es6 | 5 ++--- .../javascripts/discourse/controllers/edit-category.js.es6 | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 index 68bb362f5dc..51e60774f5b 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 @@ -32,9 +32,8 @@ export default Discourse.DiscoveryController.extend({ return Discourse.User.currentProp('staff'); }.property(), - canOrder: function() { - return this.get('canEdit') && Discourse.SiteSettings.fixed_category_positions; - }.property('Discourse.SiteSettings.fixed_category_positions'), + fixedCategoryPositions: Discourse.computed.setting('fixed_category_positions'), + canOrder: Em.computed.and('fixedCategoryPositions', 'canEdit'), moveCategory: function(categoryId, position){ this.get('model.categories').moveCategory(categoryId, position); diff --git a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 b/app/assets/javascripts/discourse/controllers/edit-category.js.es6 index 6d56b61f6cb..981a1b3aae9 100644 --- a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-category.js.es6 @@ -114,9 +114,7 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, { return !this.get('isUncategorized') && this.get('id'); }.property('isUncategorized', 'id'), - showPositionInput: function() { - return Discourse.SiteSettings.fixed_category_positions; - }.property('Discourse.SiteSettings.fixed_category_positions'), + showPositionInput: Discourse.computed.setting('fixed_category_positions'), actions: {