mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-24 17:42:29 +00:00

The same code is used once in widget toolkit and twice in PVE already, so it makes sense to add it as a separate button. Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
23 lines
552 B
JavaScript
23 lines
552 B
JavaScript
Ext.define('Proxmox.button.AltText', {
|
|
extend: 'Proxmox.button.Button',
|
|
xtype: 'proxmoxAltTextButton',
|
|
|
|
defaultText: "",
|
|
altText: "",
|
|
|
|
listeners: {
|
|
// HACK: calculate the max button width on first render to avoid toolbar glitches
|
|
render: function(button) {
|
|
let me = this;
|
|
|
|
button.setText(me.altText);
|
|
let altWidth = button.getSize().width;
|
|
|
|
button.setText(me.defaultText);
|
|
let defaultWidth = button.getSize().width;
|
|
|
|
button.setWidth(defaultWidth > altWidth ? defaultWidth : altWidth);
|
|
},
|
|
},
|
|
});
|