← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16722: Dashboard, fixed bug, the dashboard intro was no longer being displayed for empty dashboards

 

------------------------------------------------------------
revno: 16722
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-15 00:37:13 +0200
message:
  Dashboard, fixed bug, the dashboard intro was no longer being displayed for empty dashboards
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js


--
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/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2014-09-01 19:00:23 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2014-09-14 22:37:13 +0000
@@ -5,8 +5,8 @@
 
 dhis2.db.current = function() 
 {
-	var current = localStorage[dhis2.db.currentKey];
-	
+	var current = localStorage[dhis2.db.currentKey];	
+	current = ( current == "undefined" ) ? undefined : current;	
 	return current;
 }
 
@@ -350,7 +350,14 @@
 				dhis2.db.setCurrent( first );
 			}
 			
-			dhis2.db.renderDashboard( dhis2.db.current() );		
+			if ( undefined !== dhis2.db.current() )
+			{			
+				dhis2.db.renderDashboard( dhis2.db.current() );
+			}
+			else
+			{
+				dhis2.db.clearDashboard();
+			}
 		}
 		else
 		{
@@ -367,6 +374,11 @@
 
 dhis2.db.renderDashboard = function( id )
 {
+	if ( !id )
+	{
+		return;
+	}
+	
 	$( "#dashboard-" + dhis2.db.current() ).removeClass( "currentDashboard" );
 	
 	dhis2.db.setCurrent( id );
@@ -379,11 +391,11 @@
 		
         updateSharing( data );
 
-        if( undefined !== data.dashboardItems )
+        if ( data.dashboardItems && data.dashboardItems.length )
         {
 			$.each( data.dashboardItems, function( index, dashboardItem )
 			{
-				if ( null == dashboardItem || undefined === dashboardItem )
+				if ( !dashboardItem )
 				{
 					return true;
 				}