2014-07-22 23:20:45 -04:00
|
|
|
export default Ember.ObjectController.extend({
|
2013-11-14 12:37:41 -05:00
|
|
|
categoryNameKey: null,
|
|
|
|
needs: ['adminSiteSettings'],
|
|
|
|
|
|
|
|
filteredContent: function() {
|
2014-11-26 18:01:45 -05:00
|
|
|
if (!this.get('categoryNameKey')) { return []; }
|
2013-11-14 12:37:41 -05:00
|
|
|
|
2014-11-26 18:01:45 -05:00
|
|
|
var category = this.get('controllers.adminSiteSettings.content').findProperty('nameKey', this.get('categoryNameKey'));
|
2013-11-14 12:37:41 -05:00
|
|
|
if (category) {
|
|
|
|
return category.siteSettings;
|
|
|
|
} else {
|
2014-11-26 18:01:45 -05:00
|
|
|
return [];
|
2013-11-14 12:37:41 -05:00
|
|
|
}
|
2013-11-14 14:46:17 -05:00
|
|
|
}.property('controllers.adminSiteSettings.content', 'categoryNameKey'),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
|
|
|
|
/**
|
|
|
|
Reset a setting to its default value
|
|
|
|
|
|
|
|
@method resetDefault
|
|
|
|
@param {Discourse.SiteSetting} setting The setting we want to revert
|
|
|
|
**/
|
|
|
|
resetDefault: function(setting) {
|
|
|
|
setting.set('value', setting.get('default'));
|
|
|
|
setting.save();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Save changes to a site setting
|
|
|
|
|
|
|
|
@method save
|
|
|
|
@param {Discourse.SiteSetting} setting The setting we've changed
|
|
|
|
**/
|
|
|
|
save: function(setting) {
|
|
|
|
setting.save();
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
Cancel changes to a site setting
|
|
|
|
|
|
|
|
@method cancel
|
|
|
|
@param {Discourse.SiteSetting} setting The setting we've changed but want to revert
|
|
|
|
**/
|
|
|
|
cancel: function(setting) {
|
|
|
|
setting.resetValue();
|
|
|
|
}
|
|
|
|
}
|
2013-11-14 12:37:41 -05:00
|
|
|
|
|
|
|
});
|