From bea86d9d50d498beffd0225bbfd16c0284b13c18 Mon Sep 17 00:00:00 2001 From: David Harper Date: Fri, 23 Apr 2021 20:19:57 +0200 Subject: [PATCH] Remove btn-default class when btn-link or btn-primary is added issue8440 review261721002 --- src/common.js | 5 +++-- src/wizard.js | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/common.js b/src/common.js index 9bcc030729..a49513d87c 100644 --- a/src/common.js +++ b/src/common.js @@ -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 --git a/src/wizard.js b/src/wizard.js index 7352290142..1c1b69bdeb 100644 --- a/src/wizard.js +++ b/src/wizard.js @@ -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() {