From 0601bb6d74028ae1f942761a57a6b218dec758f3 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 29 May 2013 13:33:54 -0400 Subject: [PATCH] Trivial JS clean up --- .../admin/controllers/admin_reports_controller.js | 11 ++--------- .../controllers/admin_site_settings_controller.js | 4 ++-- .../discourse/controllers/list_topics_controller.js | 12 ++++++------ 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin_reports_controller.js b/app/assets/javascripts/admin/controllers/admin_reports_controller.js index e55489d07e7..14c15402cee 100644 --- a/app/assets/javascripts/admin/controllers/admin_reports_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_reports_controller.js @@ -1,15 +1,8 @@ Discourse.AdminReportsController = Ember.ObjectController.extend({ viewMode: 'table', - // true if we're viewing the table mode - viewingTable: function() { - return this.get('viewMode') === 'table'; - }.property('viewMode'), - - // true if we're viewing the bar chart mode - viewingBarChart: function() { - return this.get('viewMode') === 'barChart'; - }.property('viewMode'), + viewingTable: Em.computed.equal('viewMode', 'table'), + viewingBarChart: Em.computed.equal('viewMode', 'barChart'), // Changes the current view mode to 'table' viewAsTable: function() { diff --git a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js index e08ec81db60..075406e889c 100644 --- a/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_site_settings_controller.js @@ -15,7 +15,7 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P @property filteredContent **/ - filteredContent: (function() { + filteredContent: function() { // If we have no content, don't bother filtering anything if (!this.present('content')) return null; @@ -37,7 +37,7 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P return true; }); - }).property('filter', 'content.@each', 'onlyOverridden'), + }.property('filter', 'content.@each', 'onlyOverridden'), /** Reset a setting to its default value diff --git a/app/assets/javascripts/discourse/controllers/list_topics_controller.js b/app/assets/javascripts/discourse/controllers/list_topics_controller.js index 63fabad349d..36ec590c03f 100644 --- a/app/assets/javascripts/discourse/controllers/list_topics_controller.js +++ b/app/assets/javascripts/discourse/controllers/list_topics_controller.js @@ -14,7 +14,7 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({ // If we're changing our channel previousChannel: null, - latest: Ember.computed.equal('content.filter', 'latest'), + latest: Ember.computed.equal('filter', 'latest'), filterModeChanged: function() { // Unsubscribe from a previous channel if necessary @@ -76,10 +76,10 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({ // Show newly inserted topics showInserted: function(e) { // Move inserted into topics - this.get('content.topics').unshiftObjects(this.get('content.inserted')); + this.get('topics').unshiftObjects(this.get('inserted')); // Clear inserted - this.set('content.inserted', Em.A()); + this.set('inserted', Em.A()); return false; }, @@ -91,9 +91,9 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({ footerMessage: function() { if (!this.get('allLoaded')) return; - var content = this.get('category'); - if( content ) { - return Em.String.i18n('topics.bottom.category', {category: content.get('name')}); + var category = this.get('category'); + if( category ) { + return Em.String.i18n('topics.bottom.category', {category: category.get('name')}); } else { var split = this.get('filter').split('/'); if (this.get('topics.length') === 0) {