← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17193: Fixed bug where leftbar retracted or extended state was skewing the dashboard view.

 

------------------------------------------------------------
revno: 17193
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-10-21 12:48:08 +0200
message:
  Fixed bug where leftbar retracted or extended state was skewing the dashboard view.
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.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-commons-resources/src/main/webapp/main.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js	2014-04-04 21:13:39 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js	2014-10-21 10:48:08 +0000
@@ -85,7 +85,7 @@
     $( '#leftBar, #orgUnitTree' ).show().animate( { direction: 'right', width: '-=150px', duration: 20 } );
     $( '#mainPage' ).animate( { direction: 'right', marginLeft: '-=150px', duration: 20 } );
     $( '#hideMainMenuLink' ).attr( 'href', 'javascript:javascript:dhis2.leftBar.hideAnimated()' );
-}
+};
 
 dhis2.leftBar.hideAnimated = function()
 {
@@ -103,6 +103,17 @@
     $( '#mainPage' ).css( 'margin-left', '20px' );
 };
 
+/**
+ * Resets the left bar to its initial position (but does not change the kept state).
+ * Useful for avoiding left bar extended/retracted position skewing the dashboard view.
+ */
+dhis2.leftBar.resetPosition = function()
+{
+    $( '#leftBar' ).hide();
+    $( '#showLeftBar').hide();
+    $( '#mainPage' ).css( 'margin-left', '20px' );
+};
+
 dhis2.leftBar.setMenuVisible = function()
 {
     $.get( '../dhis-web-commons/menu/setMenuState.action?state=VISIBLE' );        

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2014-09-01 19:00:23 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2014-10-21 10:48:08 +0000
@@ -18,6 +18,10 @@
 var i18n_see_more_hits = '$encoder.jsEscape( $i18n.getString( "see_more_hits" ), "'")';
 var i18n_see_fewer_hits = '$encoder.jsEscape( $i18n.getString( "see_fewer_hits" ), "'")';
 var i18n_add = '$encoder.jsEscape( $i18n.getString( "add" ), "'")';
+
+jQuery( document ).ready( function() {
+  dhis2.leftBar.resetPosition(); ## Force left bar initial position when displaying dashboard
+});
 </script>
 
 <div id="dashboardHeader"><h3>