=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js 2014-03-30 10:32:05 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js 2014-04-03 15:35:50 +0000 @@ -63,18 +63,24 @@ var id = $(element).parent().attr('id'), dropdown_menu = $('div#' + id.split('_')[0]); + function closeAllDropdowns() { + $('.app-menu-dropdown').each(function () { + $(this).attr('data-clicked-open', 'false'); + $(this).hide(); + }); + hideDropDown(); + } + $(element).click(function () { - var open = false; - return function () { - if (open === true) { + var thisDropDownStatus = $(dropdown_menu).attr('data-clicked-open'); + closeAllDropdowns(); + + if (thisDropDownStatus === 'true') { $(dropdown_menu).attr('data-clicked-open', 'false'); - hideDropDown(); - open = false; } else { $(dropdown_menu).attr('data-clicked-open', 'true'); showDropDown(dropdown_menu.attr('id')); - open = true; } } }());