changeset 698463b5d53d in sao:default
details: https://hg.tryton.org/sao?cmd=changeset&node=698463b5d53d
description:
        Remove btn-default class when btn-link or btn-primary is added

        issue8440
        review261721002
diffstat:

 src/common.js |   5 +++--
 src/wizard.js |  10 ++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r 65895a545460 -r 698463b5d53d src/common.js
--- a/src/common.js     Thu Apr 22 23:45:00 2021 +0200
+++ b/src/common.js     Fri Apr 23 20:19:57 2021 +0200
@@ -807,7 +807,7 @@
     };
 
     Sao.common.Button = Sao.class_(Object, {
-        init: function(attributes, el, size) {
+        init: function(attributes, el, size, style) {
             this.attributes = attributes;
             if (el) {
                 this.el = el;
@@ -830,7 +830,8 @@
                 }).prependTo(this.el);
                 this.icon.hide();
             }
-            this.el.addClass('btn btn-default ' + (size || ''));
+            this.el.addClass(
+                ['btn', (style || 'btn-default'), (size || '')].join(' '));
             this.el.attr('type', 'button');
             this.icon.attr('aria-hidden', true);
             this.set_icon(attributes.icon);
diff -r 65895a545460 -r 698463b5d53d src/wizard.js
--- a/src/wizard.js     Thu Apr 22 23:45:00 2021 +0200
+++ b/src/wizard.js     Fri Apr 23 20:19:57 2021 +0200
@@ -142,13 +142,15 @@
             this.process();
         },
         _get_button: function(definition) {
-            var button = new Sao.common.Button(definition);
-            this.states[definition.state] = button;
+            var style = 'btn-default';
             if (definition.default) {
-                button.el.addClass('btn-primary');
+                style = 'btn-primary';
             } else if (definition.state == this.end_state) {
-                button.el.addClass('btn-link');
+                style = 'btn-link';
             }
+            var button = new Sao.common.Button(
+                definition, undefined, undefined, style);
+            this.states[definition.state] = button;
             return button;
         },
         update_buttons: function() {

Reply via email to