changeset 552889095191 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=552889095191
description:
Connect only once wizard dialog to keydown
update is called on each state so it binds multiple times to keydown
and call
multiple times response with end state. This results in trying to delete
multiple times the same wizard session which fails.
issue8179
review60591002
(grafted from e937c0f4b24bbc2dd816b53bf0b986df580907db)
diffstat:
src/wizard.js | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (33 lines):
diff -r c6d4386ad622 -r 552889095191 src/wizard.js
--- a/src/wizard.js Fri Mar 15 11:14:16 2019 +0100
+++ b/src/wizard.js Fri Mar 15 11:18:14 2019 +0100
@@ -235,6 +235,14 @@
this.dialog = dialog.modal;
this.content = dialog.content;
this.footer = dialog.footer;
+ this.dialog.on('keydown', function(e) {
+ if (e.which == Sao.common.ESC_KEYCODE) {
+ e.preventDefault();
+ if (this.end_state in this.states) {
+ this.response(this.end_state);
+ }
+ }
+ }.bind(this));
dialog.body.append(this.widget).append(this.info_bar.el);
},
clean: function() {
@@ -263,14 +271,6 @@
this.content.unbind('submit');
Sao.Wizard.Dialog._super.update.call(this, view, buttons);
this.dialog.modal('show');
- this.dialog.on('keydown', function(e) {
- if (e.which == Sao.common.ESC_KEYCODE) {
- e.preventDefault();
- if (this.end_state in this.states) {
- this.response(this.end_state);
- }
- }
- }.bind(this));
},
destroy: function(action) {
Sao.Wizard.Dialog._super.destroy.call(this, action);