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
Jason Williams 7490d350ea Convert general settings page to ember data
Issue #2846
-Implement custom RESTAdapter and serializer for settings data.
-Convert theme selector to Ember.Select.
-Finish upload modal and wire into settings page.
2014-06-20 04:38:41 +00:00

41 lines
1.2 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.showSuccess('Settings successfully saved.');
return model;
}).catch(this.notifications.showErrors);
},
}
});
export default SettingsGeneralController;