← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18084: Dashboard, minor

 

------------------------------------------------------------
revno: 18084
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-01-21 13:17:13 +0100
message:
  Dashboard, minor
modified:
  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/style/dashboard.css


--
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	2015-01-21 10:35:06 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2015-01-21 12:17:13 +0000
@@ -31,9 +31,8 @@
 dhis2.db.shapeDoubleWidth = "double_width";
 dhis2.db.shapeFullWidth = "full_width";
 dhis2.db.widthNormal = 408;
-dhis2.db.widthDouble = 849;
+dhis2.db.widthDouble = 847;
 dhis2.db.visualItemTypes = ["chart", "eventChart", "map", "reportTable", "eventReport"];
-
 dhis2.db.itemContentHeight = 308;
 dhis2.db.itemScrollbarWidth = /\bchrome\b/.test(navigator.userAgent.toLowerCase()) ? 8 : 17;
 
@@ -413,9 +412,9 @@
 dhis2.db.getFullWidth = function()
 {
 	var viewPortWidth = $( window ).width(),
-		spacing = 33,
+		spacing = 31,
 		itemWidth = 408,
-		items = Math.floor( ( viewPortWidth + spacing ) / ( itemWidth + spacing ) ),
+		items = Math.floor( ( viewPortWidth - spacing ) / ( itemWidth + spacing ) ),
 		fullWidth = ( items * itemWidth ) + ( ( items - 1 ) * spacing );
 
 	return fullWidth;
@@ -475,17 +474,19 @@
 {
 	if ( undefined !== dhis2.db.current() ) {
 		var url = "../api/dashboards/" + dhis2.db.current() + "?fields=dashboardItems[id,shape]",
-			viewPortWidth = $( window ).width();
+			viewPortWidth = $( window ).width(),
+			marginAndSpacing = 60,
+			realWidth = ( viewPortWidth - marginAndSpacing );
 
 		$.getJSON( url, function( dashboard ) {
 			$.each( dashboard.dashboardItems, function( i, item ) {
 				if ( dhis2.db.shapeFullWidth == item.shape ) {
 					dhis2.db.setFullItemWidth( item.id );
 				}
-				else if ( viewPortWidth <= dhis2.db.widthDouble && dhis2.db.shapeDoubleWidth == item.shape ) {
+				else if ( realWidth <= dhis2.db.widthDouble && dhis2.db.shapeDoubleWidth == item.shape ) {
 					dhis2.db.setNormalItemWidth( item.id );
 				}
-				else if ( viewPortWidth > dhis2.db.widthDouble && dhis2.db.shapeDoubleWidth == item.shape ) {
+				else if ( realWidth > dhis2.db.widthDouble && dhis2.db.shapeDoubleWidth == item.shape ) {
 					dhis2.db.setDoubleItemWidth( item.id );
 				}
 			} );

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2015-01-20 11:35:02 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2015-01-21 12:17:13 +0000
@@ -99,7 +99,7 @@
   height: 333px;
   width: 408px;
   padding: 6px;
-  margin: 0 19px 19px 0;
+  margin: 0 17px 17px 0;
   border-radius: 3px;
   cursor: pointer;
   box-shadow: #ddd 0 1px 2px 0;
@@ -139,7 +139,7 @@
   width: 408px;
   height: 333px;
   padding: 6px;
-  margin: 0 19px 19px 0;
+  margin: 0 17px 17px 0;
   border: 1px dashed #9ec5df;
   background-color: #e9f5fb;
   border-radius: 3px;