=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/menu.css' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/menu.css 2014-04-03 10:43:18 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/menu.css 2014-04-04 21:13:39 +0000 @@ -362,18 +362,18 @@ overflow-x: hidden; } -#menuDropDown1 ul { +#appsDropDown ul { height: 330px; } -#menuDropDown1 .caret-up-background, -#menuDropDown1 .caret-up-border +#appsDropDown .caret-up-background, +#appsDropDown .caret-up-border { left: 296px; } -#menuDropDown3 .caret-up-background, -#menuDropDown3 .caret-up-border +#profileDropDown .caret-up-background, +#profileDropDown .caret-up-border { left: 292px; } === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js 2014-04-03 15:58:51 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.js 2014-04-04 21:13:39 +0000 @@ -369,14 +369,14 @@ $.template('appMenuItemTemplate', markup); function renderDropDownFavorites() { - var selector = '#menuDropDown1 .menuDropDownBox', + var selector = '#appsDropDown .menuDropDownBox', apps = dhis2.menu.getOrderedAppList(); - $('#menuDropDown1').addClass('app-menu-dropdown ui-helper-clearfix'); + $('#appsDropDown').addClass('app-menu-dropdown ui-helper-clearfix'); $(selector).html(''); $.tmpl( "appMenuItemTemplate", apps).appendTo(selector); - $('#menuDropDown1 .menu-drop-down-scroll .apps-menu-more').remove(); - $('.apps-menu-more').clone().css('display', 'table').addClass('ui-helper-clearfix').appendTo($('#menuDropDown1 .menu-drop-down-scroll')); + $('#appsDropDown .menu-drop-down-scroll .apps-menu-more').remove(); + $('.apps-menu-more').clone().css('display', 'table').addClass('ui-helper-clearfix').appendTo($('#appsDropDown .menu-drop-down-scroll')); } function renderAppManager(selector) { @@ -476,6 +476,10 @@ * TODO: Check the urls (they seem to be specific to the dev location atm) */ $(function () { + var menuTimeout = 500, + closeTimer = null, + dropDownId = null; + $.ajax('../dhis-web-commons/menu/getModules.action').success(function (data) { if (typeof data.modules === 'object') { menu.addMenuItems(data.modules); @@ -485,7 +489,7 @@ //TODO: Translate this error message var error_template = '
  • Unable to load your apps, click to refresh
  • '; $('#' + selector).addClass('app-menu').html(''); - $('#menuDropDown1 .menuDropDownBox').html(error_template); + $('#appsDropDown .menuDropDownBox').html(error_template); }); /** @@ -505,12 +509,11 @@ $(window).resize(twoColumnRowFix); /** - * Adds a scrolling mechanism that modifies the height of the menu box to show only two rows - * Additionally it makes space for the scrollbar and shows/hides the more apps button + * Adds a scrolling mechanism that makes space for the scrollbar and shows/hides the more apps button */ $('.menu-drop-down-scroll').scroll(function (event) { var self = $(this), - moreAppsElement = $('#menuDropDown1 > .apps-menu-more'); + moreAppsElement = $('#appsDropDown > .apps-menu-more'); if (self.scrollTop() < 10) { moreAppsElement.show(); @@ -526,43 +529,68 @@ }); + function showDropDown( id ) + { + var newDropDownId = "#" + id, + position = $(newDropDownId + '_button').position(); + + cancelHideDropDownTimeout(); + + $(newDropDownId).css('position', 'absolute'); + $(newDropDownId).css('top', '55px'); + $(newDropDownId).css('left', Math.ceil(position.left - Math.ceil(parseInt($(newDropDownId).innerWidth(), 10) - 108)) + 'px'); + + + if ( dropDownId != newDropDownId ) { + hideDropDown(); + + dropDownId = newDropDownId; + + $( dropDownId ).show(); + } + } + + function hideDropDown() { + if ( dropDownId ) { + if ($( dropDownId ).attr( 'data-clicked-open' ) === 'true') { + return; + } + $( dropDownId ).hide(); + + dropDownId = null; + } + } + + function hideDropDownTimeout() { + closeTimer = window.setTimeout( hideDropDown, menuTimeout ); + } + + function cancelHideDropDownTimeout() { + if ( closeTimer ) { + window.clearTimeout( closeTimer ); + + closeTimer = null; + } + } + // Set show and hide drop down events on top menu - - $( "#menuLink1" ).hover( function() - { - showDropDown( "menuDropDown1" ); - }, - function() - { - hideDropDownTimeout(); - } ); - - $( "#menuLink2" ).hover( function() - { - showDropDown( "menuDropDown2" ); - }, - function() - { - hideDropDownTimeout(); - } ); - - $( "#menuLink3" ).hover( function() - { - showDropDown( "menuDropDown3" ); - }, - function() - { - hideDropDownTimeout(); - } ); - - $( "#menuDropDown1, #menuDropDown2, #menuDropDown3" ).hover( function() - { - cancelHideDropDownTimeout(); - }, - function() - { - hideDropDownTimeout(); - } ); + $( "#appsMenuLink" ).hover(function() { + showDropDown( "appsDropDown" ); + }, function() { + hideDropDownTimeout(); + }); + + $( "#profileMenuLink" ).hover(function() { + showDropDown( "profileDropDown" ); + }, function() { + hideDropDownTimeout(); + }); + + $( "#appsDropDown, #profileDropDown" ).hover(function() { + cancelHideDropDownTimeout(); + }, function() { + hideDropDownTimeout(); + }); $('.drop-down-menu-link').get().forEach(function (element, index, elements) { === 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-04-03 15:58:51 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js 2014-04-04 21:13:39 +0000 @@ -41,64 +41,6 @@ } // ----------------------------------------------------------------------------- -// Menu functions -// ----------------------------------------------------------------------------- - -var menuTimeout = 500; -var closeTimer = null; -var dropDownId = null; - -function showDropDown( id ) -{ - var newDropDownId = "#" + id, - position = $(newDropDownId + '_button').position(); - - cancelHideDropDownTimeout(); - - $(newDropDownId).css('position', 'absolute'); - $(newDropDownId).css('top', '55px'); - $(newDropDownId).css('left', Math.ceil(position.left - Math.ceil(parseInt($(newDropDownId).innerWidth(), 10) - 108)) + 'px'); - - - if ( dropDownId != newDropDownId ) - { - hideDropDown(); - - dropDownId = newDropDownId; - - $( dropDownId ).show(); - } -} - -function hideDropDown() -{ - if ( dropDownId ) - { - if ($( dropDownId ).attr( 'data-clicked-open' ) === 'true') { - return; - } - $( dropDownId ).hide(); - - dropDownId = null; - } -} - -function hideDropDownTimeout() -{ - closeTimer = window.setTimeout( "hideDropDown()", menuTimeout ); -} - -function cancelHideDropDownTimeout() -{ - if ( closeTimer ) - { - window.clearTimeout( closeTimer ); - - closeTimer = null; - } -} - -// ----------------------------------------------------------------------------- // Leftbar // ----------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-04-02 17:19:53 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-04-04 21:13:39 +0000 @@ -87,19 +87,19 @@ -