diff options
| author | Xavier Morel <xmo@openerp.com> | 2013-12-03 12:13:23 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2013-12-03 12:13:23 +0100 |
| commit | 9d9d3f207e7e6089d01f0b7fe26d7fd9cda0ddce (patch) | |
| tree | 815a9a2c9a0aecc43c3c96b30c62b25a5d22233d | |
| parent | c86e61f8d9dcf5101ac5be4b22da2fbf5bc34185 (diff) | |
[IMP] cancellation of RTE
* rename Cancel to Discard for clarity (user test)
* add intermediate dialog in case of mis-click, use 'danger' button
style to clearly indicate this is a destructive operation
bzr revid: xmo@openerp.com-20131203111323-9mx7aazfpsybe718
| -rw-r--r-- | addons/website/static/src/js/website.editor.js | 15 | ||||
| -rw-r--r-- | addons/website/static/src/xml/website.editor.xml | 26 |
2 files changed, 39 insertions, 2 deletions
diff --git a/addons/website/static/src/js/website.editor.js b/addons/website/static/src/js/website.editor.js index b5caac71d74..5128a3028ce 100644 --- a/addons/website/static/src/js/website.editor.js +++ b/addons/website/static/src/js/website.editor.js @@ -555,7 +555,20 @@ }); }, cancel: function () { - website.reload(); + new $.Deferred(function (d) { + var $dialog = $(openerp.qweb.render('website.editor.discard')).appendTo(document.body); + $dialog.on('click', '.btn-danger', function () { + d.resolve(); + }).on('hidden.bs.modal', function () { + d.reject(); + }); + d.always(function () { + $dialog.remove(); + }); + $dialog.modal('show'); + }).then(function () { + website.reload(); + }) }, new_page: function (ev) { ev.preventDefault(); diff --git a/addons/website/static/src/xml/website.editor.xml b/addons/website/static/src/xml/website.editor.xml index 8f749374485..8c1adf1ee27 100644 --- a/addons/website/static/src/xml/website.editor.xml +++ b/addons/website/static/src/xml/website.editor.xml @@ -6,7 +6,7 @@ <button type="button" data-action="save" class="btn btn-primary">Save</button> <button type="button" data-action="cancel" - class="btn">Cancel</button> + class="btn">Discard</button> </form> <ul class="nav navbar-nav pull-right"> </ul> @@ -170,4 +170,28 @@ </table> </t> + <t t-name="website.editor.discard"> + <div class="modal" tabindex="-1" role="dialog" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> + <h3 class="modal-title">Discard edition</h3> + </div> + <div class="modal-body"> + <p> + If you discard the current edition, <em>all</em> + unsaved changes will be lost. + </p> + <p>You can cancel to return to the edition mode.</p> + </div> + <div class="modal-footer"> + <button type="button" class="btn btn-danger">Discard</button> + <button type="button" class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> + </div> + </div> + </div> + </div> + </t> + </templates> |
