2014-03-21 06:55:32 +04:00
|
|
|
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'),
|
|
|
|
|
2014-06-20 06:29:49 +04:00
|
|
|
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(),
|
|
|
|
|
2014-03-21 06:55:32 +04:00
|
|
|
actions: {
|
2014-06-18 00:20:54 +04:00
|
|
|
save: function () {
|
2014-06-20 06:29:49 +04:00
|
|
|
var self = this;
|
2014-03-21 06:55:32 +04:00
|
|
|
|
2014-06-20 06:29:49 +04:00
|
|
|
return this.get('model').save().then(function (model) {
|
2014-07-02 07:34:46 +04:00
|
|
|
self.notifications.closePassive();
|
2014-06-20 06:29:49 +04:00
|
|
|
self.notifications.showSuccess('Settings successfully saved.');
|
2014-06-24 10:33:24 +04:00
|
|
|
|
2014-06-20 06:29:49 +04:00
|
|
|
return model;
|
2014-06-24 10:33:24 +04:00
|
|
|
}).catch(function (errors) {
|
2014-07-02 07:34:46 +04:00
|
|
|
self.notifications.closePassive();
|
2014-06-24 10:33:24 +04:00
|
|
|
self.notifications.showErrors(errors);
|
|
|
|
});
|
2014-03-21 06:55:32 +04:00
|
|
|
},
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-20 06:29:49 +04:00
|
|
|
export default SettingsGeneralController;
|