changeset b94b4dbddcf3 in sao:5.0
details: https://hg.tryton.org/sao?cmd=changeset;node=b94b4dbddcf3
description:
        Properly test always checkbox in user warning

        We stop using callback on checkbox to store the value but use directly 
the
        value from the widget.

        issue8847
        review272541002
        (grafted from 6706f4c73bccf23578fd41371e6e86e004ad3d78)
diffstat:

 src/common.js |  22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diffs (42 lines):

diff -r 71223b6e1455 -r b94b4dbddcf3 src/common.js
--- a/src/common.js     Sat Nov 30 22:44:57 2019 +0100
+++ b/src/common.js     Thu Dec 05 21:43:59 2019 +0100
@@ -2890,20 +2890,18 @@
 
     Sao.common.UserWarningDialog = Sao.class_(Sao.common.WarningDialog, {
         class_: 'user-warning-dialog',
-        always: false,
-        _set_always: function() {
-            this.always = jQuery(this).prop('checked');
-        },
         build_dialog: function(message, title, prm) {
             var dialog = Sao.common.UserWarningDialog._super.build_dialog.call(
                 this, message, title, prm);
-            dialog.body.append(jQuery('<div/>')
-                .append(jQuery('<input/>', {
-                    'type': 'checkbox'
-                }).change(this._set_always.bind(this)))
-                .append(jQuery('<span/>')
-                    .text(Sao.i18n.gettext('Always ignore this warning.')))
-                );
+            var always = jQuery('<input/>', {
+                'type': 'checkbox'
+            });
+            dialog.body.append(jQuery('<div/>', {
+                'class': 'checkbox',
+            }).append(jQuery('<label/>')
+                .append(always)
+                .append(Sao.i18n.gettext('Always ignore this warning.')))
+            );
             dialog.body.append(jQuery('<p/>')
                     .text(Sao.i18n.gettext('Do you want to proceed?')));
             dialog.footer.children().remove();
@@ -2919,7 +2917,7 @@
                 'type': 'button'
             }).append(Sao.i18n.gettext('Yes')).click(function() {
                 this.close(dialog);
-                if (this.always) {
+                if (always.prop('checked')) {
                     prm.resolve('always');
                 }
                 prm.resolve('ok');

Reply via email to