[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
This commit is contained in:
Xavier Morel
2013-12-03 12:13:23 +01:00
parent c86e61f8d9
commit 9d9d3f207e
2 changed files with 39 additions and 2 deletions
+14 -1
View File
@@ -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();
@@ -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>