0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Merge pull request #3873 from jaswilli/issue-3839

Show warning dialog if session has ended in editor
This commit is contained in:
Hannah Wolfe 2014-08-25 21:04:37 +01:00
commit 65d56b07bc
3 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,34 @@
var AuthFailedUnsavedController = Ember.Controller.extend({
editorController: Ember.computed.alias('model'),
actions: {
confirmAccept: function () {
var editorController = this.get('editorController');
if (editorController) {
editorController.get('model').rollback();
}
window.onbeforeunload = null;
window.location = this.get('ghostPaths').adminRoot + '/signin/';
},
confirmReject: function () {
}
},
confirm: {
accept: {
text: 'Leave',
buttonClass: 'btn btn-red'
},
reject: {
text: 'Stay',
buttonClass: 'btn btn-default btn-minor'
}
}
});
export default AuthFailedUnsavedController;

View file

@ -13,6 +13,18 @@ var ApplicationRoute = Ember.Route.extend(SimpleAuth.ApplicationRouteMixin, Shor
},
actions: {
authorizationFailed: function () {
var currentRoute = this.get('controller').get('currentRouteName');
if (currentRoute.split('.')[0] === 'editor') {
this.send('openModal', 'auth-failed-unsaved', this.controllerFor(currentRoute));
return;
}
this._super();
},
closePopups: function () {
this.get('popover').closePopovers();
this.get('notifications').closeAll();

View file

@ -0,0 +1,8 @@
{{#gh-modal-dialog action="closeModal" showClose=true type="action" style="wide,centered" animation="fade"
title="Post NOT saved." confirm=confirm}}
<p>Hey there! Something has gone wrong and you have been logged out. It looks like you have unsaved content that will be lost if you leave this page.</p>
<p>Copy your content somewhere safe before you go!</p>
{{/gh-modal-dialog}}