← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11520: Dashboard fix

 

------------------------------------------------------------
revno: 11520
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-07-25 20:52:33 +0200
message:
  Dashboard fix
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardController.java
  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-api/src/main/java/org/hisp/dhis/api/controller/DashboardController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardController.java	2013-07-24 15:55:13 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/DashboardController.java	2013-07-25 18:52:33 +0000
@@ -154,9 +154,9 @@
         ContextUtils.okResponse( response, "Dashboard item added" );
     }
     
-    @RequestMapping( value = "/{dashboardUid}/items/{itemUid}/move", method = RequestMethod.PUT, consumes = "application/json" )
+    @RequestMapping( value = "/{dashboardUid}/items/{itemUid}/position/{position}", method = RequestMethod.PUT, consumes = "application/json" )
     public void moveItem( HttpServletResponse response, HttpServletRequest request,
-        @PathVariable String dashboardUid, @PathVariable String itemUid, @RequestParam int position ) throws Exception
+        @PathVariable String dashboardUid, @PathVariable String itemUid, @PathVariable int position ) throws Exception
     {
         Dashboard dashboard = dashboardService.getDashboard( dashboardUid );
 

=== 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	2013-07-24 15:58:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-07-25 18:52:33 +0000
@@ -2,6 +2,7 @@
 dhis2.util.namespace( 'dhis2.db' );
 
 dhis2.db.current;
+dhis2.db.currentItem;
 dhis2.db.currentShareType;
 dhis2.db.currentShareId;
 
@@ -42,17 +43,21 @@
 	hitItem: "<li><a class='viewLink' href='${link}'><img src='../images/${img}.png'>${name}</a>" +
 	         "<a class='addLink' href='javascript:dhis2.db.addItemContent( \"${type}\", \"${id}\" )'>Add</a></li>",
 		         
-	chartItem: "<li><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>Remove</a>" +
+	chartItem: "<li><div class='dropItem' id='drop${itemId}'></div></li><li><div class='item' id='${itemId}'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>Remove</a>" +
 	           "<a href='javascript:dhis2.db.viewImage( \"../api/charts/${id}/data?width=820&height=550\", \"${name}\" )'>View full size</a>" +
 	           "<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"chart\", \"${name}\" )'>Share</a></div>" +
-	           "<div class='item'><img src='../api/charts/${id}/data?width=405&height=295' onclick='dhis2.db.exploreChart( \"${id}\" )' title='Click to explore'></div></li>",
+	           "<img src='../api/charts/${id}/data?width=405&height=295' onclick='dhis2.db.exploreChart( \"${id}\" )' title='Click to explore'></div></li>",
 	           
-	mapItem: "<li><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>Remove</a>" +
+	mapItem: "<li><div class='dropItem' id='drop${itemId}'></div></li><li><div class='item' id='${itemId}'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>Remove</a>" +
 	         "<a href='javascript:dhis2.db.viewImage( \"../api/maps/${id}/data?width=690\", \"${name}\" )'>View full size</a>" +
 	         "<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"map\", \"${name}\" )'>Share</a></div>" +
-		     "<div class='item'><img src='../api/maps/${id}/data?width=405' onclick='dhis2.db.exploreMap( \"${id}\" )' title='Click to explore'></div></li>"
+		     "<img src='../api/maps/${id}/data?width=405' onclick='dhis2.db.exploreMap( \"${id}\" )' title='Click to explore'></div></li>"
 };
 
+dhis2.db.dashboardReady = function( id )
+{
+}
+
 dhis2.db.openAddDashboardForm = function()
 {
 	$( "#addDashboardForm" ).dialog( {
@@ -167,7 +172,7 @@
 				dhis2.db.current = first;
 			}
 			
-			dhis2.db.renderDashboard( dhis2.db.current );
+			dhis2.db.renderDashboard( dhis2.db.current );		
 		}
 		else
 		{
@@ -228,14 +233,16 @@
 		{
 			$d.append( $.tmpl( dhis2.db.tmpl.dashboardIntro ) );
 		}
+		
+		dhis2.db.dashboardReady( id );
 	} );
 }
 
 dhis2.db.renderLinkItem = function( $d, itemId, contents, title )
 {
 	var html = 
-		"<li><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"" + itemId + "\" )'>Remove</a></div>" +
-		"<div class='item'><ul class='itemList'><li class='itemTitle'>" + title + "</li>";
+		"<li><div class='dropItem' id='drop" + itemId + "'></div><div class='item' id='" + itemId + "'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"" + itemId + "\" )'>Remove</a></div>" +
+		"<ul class='itemList'><li class='itemTitle'>" + title + "</li>";
 	
 	$.each( contents, function( index, content )
 	{

=== 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	2013-07-25 11:45:02 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2013-07-25 18:52:33 +0000
@@ -70,24 +70,44 @@
 
 .item
 {
-  border: 1px solid #d0d0d0;
+  border: 1px solid #ccc;
   width: 405px;
-  height: 310px;
+  height: 328px;
   padding: 6px;
   margin: 0 19px 19px 0;
   border-radius: 3px;
   cursor: pointer;  
-  box-shadow: #ccc 0px 1px 1px 0px;
+  box-shadow: #ddd 0px 1px 1px 0px;
+}
+
+.item:hover
+{
+  border: 1px solid #aaa;
+  box-shadow: #aaa 0px 1px 1px 0px;
+}
+
+.dropItem
+{
+  width: 20px;
+  margin-right: 19px;
+  height: 340px;
+  border: 1px solid #b0d2e8;
+  background-color: #e5f3f9;
+  border-radius: 3px;
+  display: none;
 }
 
 .itemHeader
 {
-  margin: 0 0 2px 2px;
+  margin: 0 0 10px 0;
+  padding: 0 0 3px 0;
+  border-bottom: 1px solid #e0e0e0;
+  cursor: move;
 }
 
 .itemHeader a
 {
-  margin-right: 6px;
+  margin-left: 5px;
 }
 
 .itemList