1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/controllers/settings/general.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

var SettingsGeneralController = Ember.ObjectController.extend({
isDatedPermalinks: function (key, value) {
// setter
if (arguments.length > 1) {
this.set('permalinks', value ? '/:year/:month/:day/:slug/' : '/:slug/');
}
// getter
var slugForm = this.get('permalinks');
return slugForm !== '/:slug/';
}.property('permalinks'),
themes: function () {
return this.get('availableThemes').reduce(function (themes, t) {
var theme = {};
theme.name = t.name;
theme.label = t.package ? t.package.name + ' - ' + t.package.version : t.name;
theme.package = t.package;
theme.active = !!t.active;
themes.push(theme);
return themes;
}, []);
}.property('availableThemes').readOnly(),
actions: {
save: function () {
var self = this;
return this.get('model').save().then(function (model) {
// @TODO This should call closePassive() to only close passive notifications
self.notifications.closeAll();
self.notifications.showSuccess('Settings successfully saved.');
return model;
}).catch(this.notifications.showErrors);
},
}
});
export default SettingsGeneralController;