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({
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() {

View File

@ -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

View File

@ -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) {