mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
383b657e7e
No issue -Call notifications.closePassive after the resolution of the promise that generates the notifications. Otherwise multiple promises can stack up after notifications have been cleared, which results in a bunch of stacked notifications. -Remove some unnecessary propagation of rejected promises from action handlers that can result in unhandled reject errors.
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('availableThemes').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;
|