← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13078: improve position calculation of gear dropdown

 

------------------------------------------------------------
revno: 13078
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-12-01 13:19:38 +0100
message:
  improve position calculation of gear dropdown
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm	2013-11-29 14:39:56 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm	2013-12-01 12:19:38 +0000
@@ -12,24 +12,30 @@
 
 <script>
 jQuery(function() {
-  var gearDropDown = jQuery('.gearDropDown');
   var dropDown = jQuery('.dropDown');
 
-  gearDropDown.on('click', function( e ) {
-    gearDropDown.addClass('active');
+  jQuery('.gearDropDown').on('click', function( e ) {
+    var jqTarget = jQuery(e.target);
+
+    while( !jqTarget.hasClass('gearDropDown') ) {
+      jqTarget = jqTarget.parent();
+    }
+
+    jqTarget.addClass('active');
+
     dropDown.show();
 
-    dropDown.offset({
-      'top': gearDropDown.offset().top + 24,
-      'left': gearDropDown.offset().left - 35
+    dropDown.css({
+      top: jqTarget.offset().top + jqTarget.innerHeight(),
+      left: jqTarget.offset().left
     });
 
     return false;
   });
 
-  $(document).on('click', function() {
+  jQuery(document).on('click', function() {
     if( dropDown.is(":visible") ) {
-      gearDropDown.removeClass('active');
+      jQuery('.gearDropDown').removeClass('active');
       dropDown.hide();
     }
   });
@@ -66,7 +72,7 @@
   z-index                    : 10;
   border-bottom-left-radius  : 3px;
   border-bottom-right-radius : 3px;
-  box-shadow                 : #ccc 0px 1px 1px 0px;
+  box-shadow                 : #ccc 0 1px 1px 0;
 }
 
 .dropDown > ul {