← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11761: wip, ui for sharing in dashboard, remove/add link to manage dashboard depending on dashboard.acce...

 

------------------------------------------------------------
revno: 11761
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-08-23 10:36:56 +0200
message:
  wip, ui for sharing in dashboard, remove/add link to manage dashboard depending on dashboard.access.manage property
modified:
  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/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/dashboard.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2013-08-22 17:09:11 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/dashboard.vm	2013-08-23 08:36:56 +0000
@@ -1,6 +1,3 @@
-
-#sharingDialog()
-
 <script type="text/javascript">
 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" ), "'")';
@@ -13,6 +10,7 @@
 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" ), "'")';
+var i18n_manage = '$encoder.jsEscape( $i18n.getString( "manage" ), "'")';
 </script>
 
 <div id="dashboardHeader"><h3>
@@ -41,7 +39,7 @@
 <div id="dashboardControl" class="horizontalMenu dashboardList">
 	<ul>
 		<li><a class='bold' href='javascript:dhis2.db.openAddDashboardForm()'>$i18n.getString( "add" )</a></li>
-		<li><a class='bold' href='javascript:dhis2.db.openManageDashboardForm()'>$i18n.getString( "manage" )</a></li>
+		<li id="manageDashboard"></a></li>
 		<li><a class='bold' href='javascript:dhis2.db.scrollLeft()' title='$i18n.getString( "previous" )'>&lt;</a></li>
 		<li><a class='bold' href='javascript:dhis2.db.scrollRight()' title='$i18n.getString( "next" )'>&gt;</a></li>
 	</ul>

=== 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-20 04:58:55 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2013-08-23 08:36:56 +0000
@@ -260,6 +260,24 @@
 	}
 }
 
+function updateManageDashboard( dashboard ) {
+    if( dashboard.access.manage ) {
+        var manageLink = $( '<a/>' )
+            .addClass( 'bold' )
+            .text( i18n_manage )
+            .attr( 'href', 'javascript:dhis2.db.openManageDashboardForm()' );
+        $( '#manageDashboard' ).html( manageLink );
+    } else {
+        var manageLink = $( '<a/>' )
+            .addClass( 'bold' )
+            .css( 'cursor', 'default' )
+            .css( 'text-decoration', 'none' )
+            .css( 'color', 'black' )
+            .text( i18n_manage );
+        $( '#manageDashboard' ).html( manageLink );
+    }
+}
+
 dhis2.db.renderDashboardListLoadFirst = function()
 {
 	var $l = $( "#dashboardList" );
@@ -275,8 +293,8 @@
 			$.each( data.dashboards, function( index, dashboard )
 			{
 				$l.append( $.tmpl( dhis2.db.tmpl.dashboardLink, { "id": dashboard.id, "name": dashboard.name } ) );
-	
-				if ( index == 0 )
+
+                if ( index == 0 )
 				{
 					first = dashboard.id;
 				}
@@ -316,6 +334,8 @@
 	{
 		if ( undefined !== data.items )
 		{
+            updateManageDashboard( data );
+
 			$.each( data.items, function( index, item )
 			{
 				var position = index - 1;