mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-17 13:31:39 +03:00
2b0d1ee357
refs https://github.com/TryGhost/Team/issues/559 refs https://github.com/TryGhost/Team/issues/1045 - removed need for `{{will-destroy}}` in the modal template by using `willTransition()` in the route that opened the modal instead - used the property of new modals acting as promises to implement an unsaved changes confirmation modal - added `confirmUnsavedChanges()` method that opens a "are you sure you want to leave?" modal that is treated as a promise. If the modal is closed by the "Leave" button the promise returns true in which case we rollback the unsaved changes. The modal is returned so that other behaviour can use this method and wait for the confirmation result - added `willTransition()` route hook that calls `confirmUnsavedChanges()` when there are unsaved changes and will only continue to transition if the "Leave" button is pressed - added `beforeClose()` hook to the customize modal when opening so that we can prevent the customize modal from closing when "Stay" is clicked in the confirmation modal - updated `activate()` hook to store the modal instance so it can be closed later - updated `deactivate()` hook to call `.close()` on the modal instance rather than using private data/methods on the modals service
19 lines
770 B
Handlebars
19 lines
770 B
Handlebars
<div class="modal-content">
|
|
<header class="modal-header" data-test-modal="unsaved-settings">
|
|
<h1>Are you sure you want to leave this page?</h1>
|
|
</header>
|
|
<a class="close" href="" role="button" title="Close" {{on "click" @close}}>{{svg-jar "close"}}<span class="hidden">Close</span></a>
|
|
|
|
<div class="modal-body">
|
|
<p>
|
|
Hey there! It looks like you didn't save the changes you made.
|
|
</p>
|
|
|
|
<p>Save before you go!</p>
|
|
</div>
|
|
|
|
<div class="modal-footer">
|
|
<button {{on "click" (fn @close false)}} class="gh-btn" data-test-stay-button><span>Stay</span></button>
|
|
<button {{on "click" (fn @close true)}} class="gh-btn gh-btn-red" data-test-leave-button><span>Leave</span></button>
|
|
</div>
|
|
</div> |