diff --git a/CHANGELOG b/CHANGELOG index 1066a427da..8752be814b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add keyword attribute to button tag * Support field name on image tag * Use input number and toLocaleString for numeric fields * Show related record names for all windows diff --git a/src/tab.js b/src/tab.js index 5c2edaf0b1..2293593a4e 100644 --- a/src/tab.js +++ b/src/tab.js @@ -463,10 +463,6 @@ ['print', 'glyphicon-print', Sao.i18n.gettext('Print report')] ].forEach(function(menu_action) { - var disabled = false; - if (menu_action[0] != 'action') { - disabled = !toolbars[menu_action[0]].length; - } var button = jQuery('
', { 'class': 'btn-group', 'role': 'group' @@ -479,7 +475,6 @@ 'aria-haspopup': true, 'title': menu_action[2], 'id': menu_action[0], - 'disabled': disabled }) .append(jQuery('', { 'class': 'glyphicon ' + menu_action[1], @@ -507,29 +502,32 @@ 'hidden-xs'); }); var menu = button.find('ul[role*="menu"]'); - if (menu_action[0] == 'action') { - button.click(function() { - menu.find('.action_button').remove(); - var buttons = screen.get_buttons(); - buttons.forEach(function(button) { - var item = jQuery('
  • ', { - 'role': 'presentation', - 'class': 'action_button' - }) - .append( - jQuery('', { - 'role': 'menuitem', - 'href': '#', - 'tabindex': -1 - }).append( - button.attributes.string || '')) - .click(function() { - screen.button(button.attributes); - }) - .appendTo(menu); - }); + button.click(function() { + menu.find('.' + menu_action[0] + '_button').remove(); + var buttons = screen.get_buttons(); + buttons.forEach(function(button) { + var button_kw = (button.attributes.keyword || + 'action'); + if (button_kw != menu_action[0]) { + return; + } + var item = jQuery('
  • ', { + 'role': 'presentation', + 'class': menu_action[0] + '_button' + }) + .append( + jQuery('', { + 'role': 'menuitem', + 'href': '#', + 'tabindex': -1 + }).append( + button.attributes.string || '')) + .click(function() { + screen.button(button.attributes); + }) + .appendTo(menu); }); - } + }); toolbars[menu_action[0]].forEach(function(action) { var item = jQuery('
  • ', {