1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

🐛 Fixed unexpected "unsaved changes" modals when accessing screens

no issue

We weren't correctly clearing state for the "display modal" booleans when leaving screens. This meant that it was possible to end up in a state where where every time you access a screen you get the unsaved changes modal
This commit is contained in:
Kevin Ansfield 2019-12-13 17:09:06 +00:00
parent b87fe7812e
commit 693d6b48b2
5 changed files with 20 additions and 2 deletions

View file

@ -668,6 +668,7 @@ export default Controller.extend({
this.set('hasDirtyAttributes', false);
this.set('shouldFocusEditor', false);
this.set('leaveEditorTransition', null);
this.set('showLeaveEditorModal', false);
this.set('infoMessage', null);
this.set('wordCount', null);

View file

@ -16,6 +16,12 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
return this.settings.reload();
},
deactivate() {
this._super(...arguments);
this.controller.set('leaveSettingsTransition', null);
this.controller.set('showLeaveSettingsModal', false);
},
actions: {
save() {
this.controller.send('save');

View file

@ -21,12 +21,16 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
},
setupController(controller) {
// reset the leave setting transition
controller.set('leaveSettingsTransition', null);
controller.set('themes', this.store.peekAll('theme'));
this.controller.send('reset');
},
deactivate() {
this._super(...arguments);
this.controller.set('leaveSettingsTransition', null);
this.controller.set('showLeaveSettingsModal', false);
},
actions: {
save() {
// since shortcuts are run on the route, we have to signal to the components

View file

@ -23,6 +23,7 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
setupController(controller, models) {
// reset the leave setting transition
controller.set('showLeaveSettingsModal', false);
controller.set('leaveSettingsTransition', null);
controller.set('availableTimezones', models.availableTimezones);
},

View file

@ -28,6 +28,12 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
.integrationModelHook('id', params.integration_id, this, transition);
},
deactivate() {
this._super(...arguments);
this.controller.set('leaveScreenTransition', null);
this.controller.set('showUnsavedChangesModal', false);
},
actions: {
save() {
this.controller.send('save');