← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13099: ip feed edit, wip

 

------------------------------------------------------------
revno: 13099
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-02 14:45:03 +0100
message:
  ip feed edit, wip
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.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/javascript/interpretation.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.js	2013-12-02 12:30:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/interpretation.js	2013-12-02 13:45:03 +0000
@@ -99,10 +99,46 @@
   var ipCommentUid = jqInterpretationComment.data('ip-comment-uid');
 
   if( isHeader ) {
+    var jqTarget = jqInterpretation.find('.interpretationContent').find('.interpretationText');
+    setupTextArea(ipUid, ipCommentUid,jqTarget );
   } else if( isComment ) {
+    var jqTarget = jqInterpretationComment.find('.interpretationText');
+    setupTextArea(ipUid, ipCommentUid,jqTarget );
   }
 }
 
+function setupTextArea( ipUid, ipCommentUid, $target ) {
+  var oldContent = $target.html().trim();
+
+  var textArea = jQuery("<textarea />")
+    .css({ 'width': '100%', 'height': '80px' })
+    .uniqueId()
+    .html(oldContent);
+
+  var container = jQuery("<div />")
+    .uniqueId()
+    .append(textArea);
+
+  var cancelButton = jQuery("<button/>")
+    .text('Cancel')
+    .on('click', function( e ) {
+      $target.html(oldContent);
+    });
+
+  var saveButton = jQuery("<button/>")
+    .text('Save')
+    .on('click', function( e ) {
+      alert('save is not implemented');
+    });
+
+  container.append(cancelButton);
+  container.append(saveButton);
+
+  $target.html(container);
+
+  textArea.focus();
+}
+
 function deleteIp( e ) {
   var jqActiveGearDropDown = jQuery('.gearDropDown.active');
   var isHeader = jqActiveGearDropDown.parents('.interpretationContent').length != 0;