Trivial JS clean up

This commit is contained in:
Robin Ward 2013-05-29 13:33:54 -04:00
parent 6abd9ddd2d
commit 0601bb6d74
3 changed files with 10 additions and 17 deletions

View File

@ -1,15 +1,8 @@
Discourse.AdminReportsController = Ember.ObjectController.extend({ Discourse.AdminReportsController = Ember.ObjectController.extend({
viewMode: 'table', viewMode: 'table',
// true if we're viewing the table mode viewingTable: Em.computed.equal('viewMode', 'table'),
viewingTable: function() { viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
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'),
// Changes the current view mode to 'table' // Changes the current view mode to 'table'
viewAsTable: function() { viewAsTable: function() {

View File

@ -15,7 +15,7 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P
@property filteredContent @property filteredContent
**/ **/
filteredContent: (function() { filteredContent: function() {
// If we have no content, don't bother filtering anything // If we have no content, don't bother filtering anything
if (!this.present('content')) return null; if (!this.present('content')) return null;
@ -37,7 +37,7 @@ Discourse.AdminSiteSettingsController = Ember.ArrayController.extend(Discourse.P
return true; return true;
}); });
}).property('filter', 'content.@each', 'onlyOverridden'), }.property('filter', 'content.@each', 'onlyOverridden'),
/** /**
Reset a setting to its default value Reset a setting to its default value

View File

@ -14,7 +14,7 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
// If we're changing our channel // If we're changing our channel
previousChannel: null, previousChannel: null,
latest: Ember.computed.equal('content.filter', 'latest'), latest: Ember.computed.equal('filter', 'latest'),
filterModeChanged: function() { filterModeChanged: function() {
// Unsubscribe from a previous channel if necessary // Unsubscribe from a previous channel if necessary
@ -76,10 +76,10 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
// Show newly inserted topics // Show newly inserted topics
showInserted: function(e) { showInserted: function(e) {
// Move inserted into topics // Move inserted into topics
this.get('content.topics').unshiftObjects(this.get('content.inserted')); this.get('topics').unshiftObjects(this.get('inserted'));
// Clear inserted // Clear inserted
this.set('content.inserted', Em.A()); this.set('inserted', Em.A());
return false; return false;
}, },
@ -91,9 +91,9 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
footerMessage: function() { footerMessage: function() {
if (!this.get('allLoaded')) return; if (!this.get('allLoaded')) return;
var content = this.get('category'); var category = this.get('category');
if( content ) { if( category ) {
return Em.String.i18n('topics.bottom.category', {category: content.get('name')}); return Em.String.i18n('topics.bottom.category', {category: category.get('name')});
} else { } else {
var split = this.get('filter').split('/'); var split = this.get('filter').split('/');
if (this.get('topics.length') === 0) { if (this.get('topics.length') === 0) {