Remove btn-default class when btn-link or btn-primary is added

issue8440
review261721002
This commit is contained in:
David Harper committed 2021-04-23 20:19:57 +02:00
1 parent e5f07651b9
commit bea86d9d50
2 files changed
+9 -6

No files matched your search

+3 -2
View File
@@ -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);
+6 -4
View File
@@ -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() {