← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8935: Showing only last 4 interpretation comments to avoid scrolling, with function for showing all

 

------------------------------------------------------------
revno: 8935
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-11-07 16:14:27 +0300
message:
  Showing only last 4 interpretation comments to avoid scrolling, with function for showing all
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.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/interpretationFeed.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm	2012-11-06 15:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/interpretationFeed.vm	2012-11-07 13:14:27 +0000
@@ -1,3 +1,4 @@
+#set( $maxComments = 4 )
 #foreach( $ip in $interpretations )
 <div class="interpretationContainer">
     <div class="interpretationSymbol">
@@ -45,18 +46,22 @@
 	    </div>
 	    
 	    #set( $comments = $ip.comments )
-	    <div class="interpretationCommentArea">
-	        <div id="comments${ip.uid}">
+	    #set( $commentStartPos = ( $comments.size() - $maxComments ) )
+	    <div class="interpretationCommentArea">	        
+	        #if( $comments.size() > $maxComments )
+	        <div id="commentHeader${ip.uid}" class="interpretationCommentHeader"><a href="javascript:expandComments( '${ip.uid}' )">View all $comments.size() comments</a></div>	        	
+        	#end
+        	<div id="comments${ip.uid}">
 	        #foreach( $comment in $comments )
-	        <div>
+	        <div #if( $velocityCount <= $commentStartPos ) style="display:none"#end>
 	            <div class="interpretationName">
 	                <span class="bold pointer" onclick="showUserInfo( '${comment.user.id}' )">${comment.user.name}</span>&nbsp;
 	                <span class="grey">${format.formatDate( $comment.created )}</span>
 	            </div>
-	        </div>
-	        <div class="interpretationText">
-	            ${comment.text}
-	        </div>
+		        <div class="interpretationText">
+		            ${comment.text}
+		        </div>
+            </div>
 	        #end
 	        </div>
 	        <textarea id="commentArea${ip.uid}" class="commentArea" placeholder="$i18n.getString( 'add_a_comment' )..."></textarea>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.js	2012-10-14 18:31:58 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.js	2012-11-07 13:14:27 +0000
@@ -12,6 +12,12 @@
 	$( "#interpretationFeed" ).load( "getInterpretations.action" );
 } );
 
+function expandComments( id )
+{
+	$( "#comments" + id ).children().show();
+	$( "#commentHeader" + id ).hide();
+}
+
 function isNextPage()
 {
 	var fromTop = $( document ).scrollTop();
@@ -75,4 +81,4 @@
 			}		
 		} );
 	}
-}
\ No newline at end of file
+}

=== 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	2012-11-06 14:03:24 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-11-07 13:14:27 +0000
@@ -191,6 +191,14 @@
   margin: 0 0 6px 4px;
 }
 
+.interpretationCommentHeader
+{
+  padding: 7px 0 5px 0;
+  margin: 1px 0 12px 0;
+  border-top: 1px solid #fff;
+  border-bottom: 1px solid #fff;
+}
+
 a.alert, .alert
 {
   color: #E92B2B;