changeset 4cad1c465d8e in sao:4.8
details: https://hg.tryton.org/sao?cmd=changeset;node=4cad1c465d8e
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 1f343d051a85 -r 4cad1c465d8e src/wizard.js
--- a/src/wizard.js     Fri Mar 08 18:38:16 2019 +0100
+++ b/src/wizard.js     Fri Mar 15 11:18:14 2019 +0100
@@ -219,6 +219,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() {
@@ -248,14 +256,6 @@
             Sao.Wizard.Dialog._super.update.call(this, view, defaults,
                     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);

Reply via email to