Fix size of context sidebar refresh toggle buttons

This commit is contained in:
Nick O'Leary 2020-09-22 23:44:10 +01:00
parent 2f33575907
commit 103e212aee
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 23 additions and 6 deletions

View File

@ -46,8 +46,10 @@
this.element.on("focus", function() {
that.button.focus();
});
this.button = $('<button type="button" class="red-ui-toggleButton '+baseClass+' toggle single"><span></span></button>');
this.buttonLabel = $("<span>").appendTo(this.button);
this.button = $('<button type="button" class="red-ui-toggleButton '+baseClass+' toggle single"></button>');
if (enabledLabel || disabledLabel) {
this.buttonLabel = $("<span>").appendTo(this.button);
}
if (this.options.class) {
this.button.addClass(this.options.class)
@ -63,14 +65,18 @@
if (this.buttonIcon) {
this.buttonIcon.addClass(enabledIcon);
}
this.buttonLabel.text(enabledLabel);
if (this.buttonLabel) {
this.buttonLabel.text(enabledLabel);
}
var width = this.button.width();
this.button.removeClass("selected");
if (this.buttonIcon) {
this.buttonIcon.removeClass(enabledIcon);
that.buttonIcon.addClass(disabledIcon);
}
that.buttonLabel.text(disabledLabel);
if (this.buttonLabel) {
that.buttonLabel.text(disabledLabel);
}
width = Math.max(width,this.button.width());
if (this.buttonIcon) {
this.buttonIcon.removeClass(disabledIcon);
@ -99,7 +105,9 @@
that.buttonIcon.addClass(enabledIcon);
that.buttonIcon.removeClass(disabledIcon);
}
that.buttonLabel.text(enabledLabel);
if (that.buttonLabel) {
that.buttonLabel.text(enabledLabel);
}
} else {
that.button.removeClass("selected");
that.state = false;
@ -107,7 +115,9 @@
that.buttonIcon.addClass(disabledIcon);
that.buttonIcon.removeClass(enabledIcon);
}
that.buttonLabel.text(disabledLabel);
if (that.buttonLabel) {
that.buttonLabel.text(disabledLabel);
}
}
})
this.element.trigger("change");

View File

@ -39,6 +39,13 @@
vertical-align: top;
}
button.red-ui-toggleButton.toggle {
text-align: center;
i {
min-width: 10px;
}
}
}
.red-ui-sidebar-context-property {