2016-06-30 13:21:47 +03:00
|
|
|
import $ from 'jquery';
|
2022-01-17 13:05:27 +03:00
|
|
|
import AdminRoute from 'ghost-admin/routes/admin';
|
2017-02-21 22:04:50 +03:00
|
|
|
import RSVP from 'rsvp';
|
2017-10-30 12:38:01 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2015-01-11 22:55:52 +03:00
|
|
|
|
2022-01-17 13:05:27 +03:00
|
|
|
export default AdminRoute.extend({
|
2017-10-30 12:38:01 +03:00
|
|
|
settings: service(),
|
2015-01-11 22:55:52 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
model() {
|
2017-02-21 22:04:50 +03:00
|
|
|
return RSVP.hash({
|
2021-01-22 14:24:45 +03:00
|
|
|
settings: this.settings.reload()
|
2015-01-11 22:55:52 +03:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2021-01-22 14:24:45 +03:00
|
|
|
setupController() {
|
2019-03-06 16:53:54 +03:00
|
|
|
this.controller.send('reset');
|
2016-02-09 20:16:18 +03:00
|
|
|
},
|
|
|
|
|
2019-12-13 20:09:06 +03:00
|
|
|
deactivate() {
|
|
|
|
this._super(...arguments);
|
|
|
|
this.controller.set('leaveSettingsTransition', null);
|
|
|
|
this.controller.set('showLeaveSettingsModal', false);
|
|
|
|
},
|
|
|
|
|
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.
|
2017-02-16 22:50:05 +03:00
|
|
|
$('.page-actions .gh-btn-blue').focus();
|
2015-01-18 03:16:54 +03:00
|
|
|
|
2019-03-06 16:53:54 +03:00
|
|
|
this.controller.send('save');
|
2015-10-05 09:07:44 +03:00
|
|
|
},
|
|
|
|
|
2017-10-31 18:27:25 +03:00
|
|
|
willTransition(transition) {
|
2019-03-06 16:53:54 +03:00
|
|
|
let controller = this.controller;
|
|
|
|
let modelIsDirty = controller.dirtyAttributes;
|
2017-10-31 18:27:25 +03:00
|
|
|
|
|
|
|
if (modelIsDirty) {
|
|
|
|
transition.abort();
|
|
|
|
controller.send('toggleLeaveSettingsModal', transition);
|
|
|
|
return;
|
|
|
|
}
|
2015-01-14 17:46:29 +03:00
|
|
|
}
|
2019-05-20 18:16:19 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
buildRouteInfoMetadata() {
|
|
|
|
return {
|
2021-01-28 18:25:21 +03:00
|
|
|
titleToken: 'Settings - Navigation'
|
2019-05-20 18:16:19 +03:00
|
|
|
};
|
2015-01-11 22:55:52 +03:00
|
|
|
}
|
|
|
|
});
|