2017-01-20 12:33:54 +03:00
|
|
|
import AuthenticatedRoute from 'ghost-admin/routes/authenticated';
|
|
|
|
import styleBody from 'ghost-admin/mixins/style-body';
|
2018-10-04 13:41:11 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2017-01-20 12:33:54 +03:00
|
|
|
|
2017-03-17 20:16:21 +03:00
|
|
|
export default AuthenticatedRoute.extend(styleBody, {
|
2018-10-04 13:41:11 +03:00
|
|
|
settings: service(),
|
2017-01-20 12:33:54 +03:00
|
|
|
|
2018-10-04 13:41:11 +03:00
|
|
|
titleToken: 'AMP',
|
2018-10-04 13:02:36 +03:00
|
|
|
classNames: ['settings-view-integrations-amp'],
|
2017-05-18 13:48:37 +03:00
|
|
|
|
2018-10-04 13:41:11 +03:00
|
|
|
beforeModel() {
|
|
|
|
return this.settings.reload();
|
|
|
|
},
|
|
|
|
|
2017-05-18 13:48:37 +03:00
|
|
|
actions: {
|
|
|
|
save() {
|
|
|
|
this.get('controller').send('save');
|
2017-10-31 18:27:25 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
willTransition(transition) {
|
|
|
|
let controller = this.get('controller');
|
|
|
|
let settings = controller.get('settings');
|
|
|
|
let modelIsDirty = settings.get('hasDirtyAttributes');
|
|
|
|
|
|
|
|
if (modelIsDirty) {
|
|
|
|
transition.abort();
|
|
|
|
controller.send('toggleLeaveSettingsModal', transition);
|
|
|
|
return;
|
|
|
|
}
|
2017-05-18 13:48:37 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-20 12:33:54 +03:00
|
|
|
});
|