2015-11-18 14:58:26 +03:00
|
|
|
import Ember from 'ember';
|
2015-01-11 22:55:52 +03:00
|
|
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
|
|
|
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
2015-02-03 19:29:01 +03:00
|
|
|
import styleBody from 'ghost/mixins/style-body';
|
2015-01-11 22:55:52 +03:00
|
|
|
|
2015-11-18 14:58:26 +03:00
|
|
|
const {$} = Ember;
|
|
|
|
|
2015-08-19 14:55:40 +03:00
|
|
|
export default AuthenticatedRoute.extend(styleBody, CurrentUserSettings, {
|
2015-05-25 21:17:10 +03:00
|
|
|
titleToken: 'Settings - Navigation',
|
2015-01-11 22:55:52 +03:00
|
|
|
|
2015-02-03 19:29:01 +03:00
|
|
|
classNames: ['settings-view-navigation'],
|
|
|
|
|
2015-11-15 14:06:49 +03:00
|
|
|
beforeModel() {
|
|
|
|
this._super(...arguments);
|
2015-04-14 18:04:16 +03:00
|
|
|
return this.get('session.user')
|
|
|
|
.then(this.transitionAuthor());
|
2015-01-11 22:55:52 +03:00
|
|
|
},
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
model() {
|
|
|
|
return this.store.query('setting', {type: 'blog,theme'}).then((records) => {
|
2015-01-11 22:55:52 +03:00
|
|
|
return records.get('firstObject');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-02-09 20:16:18 +03:00
|
|
|
setupController() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.get('controller').send('reset');
|
|
|
|
},
|
|
|
|
|
2015-01-14 17:46:29 +03:00
|
|
|
actions: {
|
2015-10-28 14:36:45 +03:00
|
|
|
save() {
|
2015-01-18 03:16:54 +03:00
|
|
|
// since shortcuts are run on the route, we have to signal to the components
|
|
|
|
// on the page that we're about to save.
|
|
|
|
$('.page-actions .btn-blue').focus();
|
|
|
|
|
2015-01-14 17:46:29 +03:00
|
|
|
this.get('controller').send('save');
|
2015-10-05 09:07:44 +03:00
|
|
|
},
|
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
willTransition() {
|
2015-10-05 09:07:44 +03:00
|
|
|
// reset the model so that our CPs re-calc and unsaved changes aren't
|
|
|
|
// persisted across transitions
|
|
|
|
this.set('controller.model', null);
|
|
|
|
return this._super(...arguments);
|
2015-01-14 17:46:29 +03:00
|
|
|
}
|
2015-01-11 22:55:52 +03:00
|
|
|
}
|
|
|
|
});
|