← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11594: Dashboard, i18n

 

------------------------------------------------------------
revno: 11594
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-08-06 20:33:05 +0200
message:
  Dashboard, i18n
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
  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/mainForm.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/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2013-07-24 15:58:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties	2013-08-06 18:33:05 +0000
@@ -106,4 +106,11 @@
 groups=Groups
 search=Search
 rename_current_dashboard=Rename current dashboard
-delete_current_dashboard=Delete current dashboard
\ No newline at end of file
+delete_current_dashboard=Delete current dashboard
+add_new=Add new
+manage=Manage
+click_add_new_to_get_started=Click 'Add new' to get started
+add_stuff_by_searching=Add stuff by searching from the search field above
+arrange_dashboard_by_dragging_and_dropping=Tip: arrange dashboard by dragging and dropping items
+click_to_explore_drag_to_new_position=Click to explore or drag to new position
+drag_to_new_position=Drag to new position
\ No newline at end of file

=== 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-08-06 13:01:38 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-08-06 18:33:05 +0000
@@ -8,8 +8,7 @@
 dhis2.db.currentShareId;
 
 // TODO dashboard list horizontal scroll
-// TODO remember last dashboard
-// TODO report type
+// TODO report type in link
 
 //------------------------------------------------------------------------------
 // Document ready
@@ -38,15 +37,15 @@
 //------------------------------------------------------------------------------
 
 dhis2.db.tmpl = {
-	openAddLink: "<li><a class='bold' href='javascript:dhis2.db.openAddDashboardForm()'>Add new</a></li><li>" +
-	             "<a class='bold' href='javascript:dhis2.db.openManageDashboardForm()'>Manage</a></li>",
+	openAddLink: "<li><a class='bold' href='javascript:dhis2.db.openAddDashboardForm()'>${i18n_add}</a></li><li>" +
+	             "<a class='bold' href='javascript:dhis2.db.openManageDashboardForm()'>${i18n_manage}</a></li>",
 	
 	dashboardLink: "<li id='dashboard-${id}'><a href='javascript:dhis2.db.renderDashboard( \"${id}\" )'>${name}</a></li>",
 	
-	moduleIntro: "<li><div class='dasboardIntro'>Click Add new to get started</div></li>",
+	moduleIntro: "<li><div class='dasboardIntro'>${i18n_click}</div></li>",
 	
-	dashboardIntro: "<li><div class='dasboardIntro'>Add stuff by searching from the search field above</div>" +
-			        "<div class='dasboardTip'>Tip: Arrange your dashboard by dragging and dropping items</div></li>",
+	dashboardIntro: "<li><div class='dasboardIntro'>${i18n_add}</div>" +
+			        "<div class='dasboardTip'>${i18n_arrange}</div></li>",
 	
 	hitHeader: "<li class='hitHeader'>${title}</li>",
 	
@@ -54,16 +53,16 @@
 	         "<a class='addLink' href='javascript:dhis2.db.addItemContent( \"${type}\", \"${id}\" )'>Add</a></li>",
 		         
 	chartItem: "<li id='liDrop-${itemId}' class='liDropItem'><div class='dropItem' id='drop-${itemId}' data-item='${itemId}'></div></li>" +
-	           "<li id='li-${itemId}' class='liItem'><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>" +
-	           "<img src='../api/charts/${id}/data?width=405&height=295' onclick='dhis2.db.exploreChart( \"${id}\" )' title='Click to explore or drag to new position'></div></li>",
+	           "<li id='li-${itemId}' class='liItem'><div class='item' id='${itemId}'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>${i18n_remove}</a>" +
+	           "<a href='javascript:dhis2.db.viewImage( \"../api/charts/${id}/data?width=820&height=550\", \"${name}\" )'>${i18n_view}</a>" +
+	           "<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"chart\", \"${name}\" )'>${i18n_share}</a></div>" +
+	           "<img src='../api/charts/${id}/data?width=405&height=295' onclick='dhis2.db.exploreChart( \"${id}\" )' title='${i18n_click}'></div></li>",
 	           
 	mapItem: "<li id='liDrop-${itemId}' class='liDropItem'><div class='dropItem' id='drop-${itemId}' data-item='${itemId}'></div></li>" +
-	         "<li id='li-${itemId}' class='liItem'><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>" +
-		     "<img src='../api/maps/${id}/data?width=405' onclick='dhis2.db.exploreMap( \"${id}\" )' title='Click to explore or drag to new position'></div></li>"
+	         "<li id='li-${itemId}' class='liItem'><div class='item' id='${itemId}'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"${itemId}\" )'>${i18n_remove}</a>" +
+	         "<a href='javascript:dhis2.db.viewImage( \"../api/maps/${id}/data?width=690\", \"${name}\" )'>${i18n_view}</a>" +
+	         "<a href='javascript:dhis2.db.viewShareForm( \"${id}\", \"map\", \"${name}\" )'>${i18n_share}</a></div>" +
+		     "<img src='../api/maps/${id}/data?width=405' onclick='dhis2.db.exploreMap( \"${id}\" )' title='${i18n_click}'></div></li>"
 };
 
 dhis2.db.dashboardReady = function( id )
@@ -235,7 +234,7 @@
 {
 	var $l = $( "#dashboardList" );
 	
-	$l.empty().append( dhis2.db.tmpl.openAddLink );
+	$l.empty().append( $.tmpl( dhis2.db.tmpl.openAddLink, { "i18n_add": i18n_add_new, "i18n_manage": i18n_manage } ) );
 	
 	$.getJSON( "../api/dashboards.json?paging=false&links=false", function( data )
 	{
@@ -263,7 +262,7 @@
 		else
 		{
 			dhis2.db.clearDashboard();
-			$( "#contentList" ).append( $.tmpl( dhis2.db.tmpl.moduleIntro ) );			
+			$( "#contentList" ).append( $.tmpl( dhis2.db.tmpl.moduleIntro, { "i18n_click": i18n_click_add_new_to_get_started } ) );			
 		}
 	} );
 }
@@ -293,11 +292,13 @@
 				
 				if ( "chart" == item.type )
 				{
-					$d.append( $.tmpl( dhis2.db.tmpl.chartItem, { "itemId": item.id, "id": item.chart.id, "name": item.chart.name, "position": position } ) )
+					$d.append( $.tmpl( dhis2.db.tmpl.chartItem, { "itemId": item.id, "id": item.chart.id, "name": item.chart.name, "position": position, 
+						"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) )
 				}
 				else if ( "map" == item.type )
 				{
-					$d.append( $.tmpl( dhis2.db.tmpl.mapItem, { "itemId": item.id, "id": item.map.id, "name": item.map.name, "position": position } ) )
+					$d.append( $.tmpl( dhis2.db.tmpl.mapItem, { "itemId": item.id, "id": item.map.id, "name": item.map.name, "position": position,
+						"i18n_remove": i18n_remove, "i18n_view": i18n_view_full_size, "i18n_share": i18n_share, "i18n_click": i18n_click_to_explore_drag_to_new_position } ) )
 				}
 				else if ( "users" == item.type )
 				{
@@ -321,7 +322,7 @@
 		}
 		else
 		{
-			$d.append( $.tmpl( dhis2.db.tmpl.dashboardIntro ) );
+			$d.append( $.tmpl( dhis2.db.tmpl.dashboardIntro, { "i18n_add": i18n_add_stuff_by_searching, "i18n_arrange": i18n_arrange_dashboard_by_dragging_and_dropping } ) );
 		}
 		
 		dhis2.db.dashboardReady( id );
@@ -332,13 +333,13 @@
 {
 	var html = 
 		"<li id='liDrop-" + itemId + "' class='liDropItem'><div class='dropItem' id='drop-" + itemId + "' data-item='" + itemId + "'></div></li>" +
-		"<li id='li-" + itemId + "' class='liItem'><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='Drag to new position'>" + title + "</li>";
+		"<li id='li-" + itemId + "' class='liItem'><div class='item' id='" + itemId + "'><div class='itemHeader'><a href='javascript:dhis2.db.removeItem( \"" + itemId + "\" )'>" + i18n_remove + "</a></div>" +
+		"<ul class='itemList'><li class='itemTitle' title='" + i18n_drag_to_new_position + "'>" + title + "</li>";
 	
 	$.each( contents, function( index, content )
 	{
 		html += 
-			"<li><a href='" + baseUrl + content.id + urlSuffix + "'>" + content.name + "</a><a class='removeItemLink' href='javascript:dhis2.db.removeItemContent( \"" + itemId + "\", \"" + content.id + "\" )' title='Remove'>" + 
+			"<li><a href='" + baseUrl + content.id + urlSuffix + "'>" + content.name + "</a><a class='removeItemLink' href='javascript:dhis2.db.removeItemContent( \"" + itemId + "\", \"" + content.id + "\" )' title='" + i18n_remove + "'>" + 
 			"<img src='../images/hide.png'></a></li>";
 	} );
 	
@@ -393,6 +394,7 @@
     	type: "delete",
     	url: "../api/dashboards/" + dhis2.db.current + "/items/" + id,
     	success: function() {
+    		dhis2.db.current = undefined;
     		dhis2.db.renderDashboard( dhis2.db.current );
     	}
     } );

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2013-08-06 14:06:25 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/mainForm.vm	2013-08-06 18:33:05 +0000
@@ -2,6 +2,16 @@
 var i18n_share_your_interpretation_of = '$encoder.jsEscape( $i18n.getString( "share_your_interpretation_of" ), "'")';
 var i18n_interpretation_was_shared = '$encoder.jsEscape( $i18n.getString( "interpretation_was_shared" ), "'")';
 var i18n_viewing = '$encoder.jsEscape( $i18n.getString( "viewing" ), "'")';
+var i18n_add_new = '$encoder.jsEscape( $i18n.getString( "add_new" ), "'")';
+var i18n_manage = '$encoder.jsEscape( $i18n.getString( "manage" ), "'")';
+var i18n_click_add_new_to_get_started = '$encoder.jsEscape( $i18n.getString( "click_add_new_to_get_started" ), "'")';
+var i18n_add_stuff_by_searching = '$encoder.jsEscape( $i18n.getString( "add_stuff_by_searching" ), "'")';
+var i18n_arrange_dashboard_by_dragging_and_dropping = '$encoder.jsEscape( $i18n.getString( "arrange_dashboard_by_dragging_and_dropping" ), "'")';
+var i18n_remove = '$encoder.jsEscape( $i18n.getString( "remove" ), "'")';
+var i18n_view_full_size = '$encoder.jsEscape( $i18n.getString( "view_full_size" ), "'")';
+var i18n_share = '$encoder.jsEscape( $i18n.getString( "share" ), "'")';
+var i18n_click_to_explore_drag_to_new_position = '$encoder.jsEscape( $i18n.getString( "click_to_explore_drag_to_new_position" ), "'")';
+var i18n_drag_to_new_position = '$encoder.jsEscape( $i18n.getString( "drag_to_new_position" ), "'")';
 </script>
 
 <div id="dashboardHeader"><h3>