Merge branch 'menu_buttons' of https://github.com/johndoh/roundcubemail into johndoh-menu_buttons

pull/6405/head
Aleksander Machniak 6 years ago
commit daf46075d0

@ -47,7 +47,7 @@ function rcube_webmail()
this.group2expand = {}; this.group2expand = {};
this.http_request_jobs = {}; this.http_request_jobs = {};
this.menu_stack = []; this.menu_stack = [];
this.menu_buttons = []; this.menu_buttons = {};
this.entity_selectors = []; this.entity_selectors = [];
this.image_style = {}; this.image_style = {};
@ -125,8 +125,11 @@ function rcube_webmail()
// 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
this.register_menu_button = function(button, menu_id) this.register_menu_button = function(button, menu_id)
{ {
if (this.menu_buttons[menu_id]) {
this.menu_buttons[menu_id][0].push(button);
}
else {
var commands = []; var commands = [];
$('#' + menu_id).find('a').each(function() { $('#' + menu_id).find('a').each(function() {
var command, link = $(this), onclick = link.attr('onclick'); var command, link = $(this), onclick = link.attr('onclick');
@ -139,7 +142,8 @@ function rcube_webmail()
}); });
if (commands.length) if (commands.length)
this.menu_buttons.push([button, commands]); this.menu_buttons[menu_id] = [[button], commands];
}
this.set_menu_buttons(); this.set_menu_buttons();
}; };

Loading…
Cancel
Save