mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
fddf2ee42f
Closes #3226 - Remove dependent property from the computed content property that is used to build the active theme selector. - Add validation to the Settings model so that it rejects attempts to set an activeTheme that is not installed.
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
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().readOnly(),
|
|
|
|
actions: {
|
|
save: function () {
|
|
var self = this;
|
|
|
|
return this.get('model').save().then(function (model) {
|
|
self.notifications.closePassive();
|
|
self.notifications.showSuccess('Settings successfully saved.');
|
|
|
|
return model;
|
|
}).catch(function (errors) {
|
|
self.notifications.closePassive();
|
|
self.notifications.showErrors(errors);
|
|
});
|
|
},
|
|
}
|
|
});
|
|
|
|
export default SettingsGeneralController;
|