Fix setting button state when registering it after onload

Also get rid of uibutton support, it's not used anymore.
pull/6724/head
Aleksander Machniak 6 years ago
parent 9ab932d9ba
commit 8036bfafab

@ -119,8 +119,10 @@ function rcube_webmail()
this.buttons[command].push(button_prop); this.buttons[command].push(button_prop);
if (this.loaded) if (this.loaded) {
this.init_button(command, button_prop); this.init_button(command, button_prop);
this.set_button(command, (this.commands[command] ? 'act' : 'pas'));
}
}; };
// register a button with popup menu, to set its state according to the state of all commands in the menu // register a button with popup menu, to set its state according to the state of all commands in the menu
@ -163,7 +165,10 @@ function rcube_webmail()
return disabled = false; return disabled = false;
} }
}); });
$(this[0]).add($(this[0]).parent('.dropbutton')).addClass(disabled ? 'disabled' : 'active').removeClass(disabled ? 'active' : 'disabled');
$(this[0]).add($(this[0]).parent('.dropbutton'))
.addClass(disabled ? 'disabled' : 'active')
.removeClass(disabled ? 'active' : 'disabled');
}); });
}, 50); }, 50);
}; };
@ -7805,14 +7810,11 @@ function rcube_webmail()
else if (button[state] !== undefined) { else if (button[state] !== undefined) {
obj.className = button[state]; obj.className = button[state];
} }
// disable/enable input buttons // disable/enable input buttons
if (button.type == 'input' || button.type == 'button') { if (button.type == 'input' || button.type == 'button') {
obj.disabled = state == 'pas'; obj.disabled = state == 'pas';
} }
else if (button.type == 'uibutton') {
button.status = state;
$(obj).button('option', 'disabled', state == 'pas');
}
else { else {
$obj = $(obj); $obj = $(obj);
$obj $obj

Loading…
Cancel
Save