← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21213: tracker/event-capture: better dispay of comments

 

------------------------------------------------------------
revno: 21213
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-27 10:35:48 +0100
message:
  tracker/event-capture: better dispay of comments
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/comments-section.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/notes.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.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-apps/src/main/webapp/dhis-web-event-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2015-11-23 09:52:35 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2015-11-27 09:35:48 +0000
@@ -404,6 +404,10 @@
     background-color: #e5e5e5
 }
 
+.wrap-text {
+    word-wrap: break-word;
+}
+
 /*.file-input input[readonly] {
     background-color: white !important;
     cursor: text !important;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/comments-section.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/comments-section.html	2015-09-08 09:15:23 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/comments-section.html	2015-11-27 09:35:48 +0000
@@ -7,13 +7,13 @@
         <table class="listTable dhis2-list-table-striped">
             <thead>
                 <tr>
-                    <th style="width:100%;">
+                    <th>
                         {{'recorded_comments'| translate}}
                     </th>
                 </tr>
             </thead>
             <tr ng-repeat="note in currentEvent.notes">
-                <td class="over-flow-hidden" style="width:100%;">
+                <td class="wrap-text">
                     <p>{{note.value}}</p>
                     <p><strong>{{'created_by'| translate}}: </strong>{{note.storedBy}}</p>
                     <p><strong>{{'date'| translate}}: </strong>{{note.storedDate}}</p>                    

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/notes.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/notes.html	2015-11-21 10:02:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/notes.html	2015-11-27 09:35:48 +0000
@@ -6,7 +6,7 @@
     <table class="dhis2-list-table-striped">    
         
         <tr ng-repeat="note in dhis2Event.notes">
-            <td class="over-flow-hidden" style="width:100%;">
+            <td class="wrap-text">
                 <p>{{note.value}}</p>
                 <p><strong>{{'created_by' | translate}}: </strong>{{note.storedBy}}</p>
                 <p><strong>{{'date' | translate}}: </strong>{{note.storedDate}}</p>                    

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-11-24 13:06:54 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2015-11-27 09:35:48 +0000
@@ -65,7 +65,7 @@
     $scope.invalidDate = false;
 
     //note
-    $scope.note = '';
+    $scope.note = {};
 
     //event color legend
     $scope.eventColors = [
@@ -742,14 +742,14 @@
     };
 
     $scope.addNote = function () {
-        if (!angular.isUndefined($scope.note) && $scope.note !== "") {
-            var newNote = {value: $scope.note};
+        if ($scope.note.value !== "" || !angular.isUndefined($scope.note.value)) {
+            var newNote = {value: $scope.note.value};
 
             if (angular.isUndefined($scope.currentEvent.notes)) {
-                $scope.currentEvent.notes = [{value: $scope.note, storedDate: today, storedBy: storedBy}];
+                $scope.currentEvent.notes = [{value: newNote.value, storedDate: today, storedBy: storedBy}];
             }
             else {
-                $scope.currentEvent.notes.splice(0, 0, {value: $scope.note, storedDate: today, storedBy: storedBy});
+                $scope.currentEvent.notes.splice(0, 0, {value: newNote.value, storedDate: today, storedBy: storedBy});
             }
 
             var e = {event: $scope.currentEvent.event,
@@ -761,7 +761,7 @@
             };
 
             DHIS2EventFactory.updateForNote(e).then(function (data) {
-                $scope.note = '';
+                $scope.note = {};
             });
         }
     };
@@ -841,10 +841,10 @@
         
         DialogService.showDialog(dialogDefaults, dialogOptions);
         
-    }
+    };
 
     $scope.clearNote = function () {
-        $scope.note = '';
+        $scope.note = {};
     };
 
     $scope.getInputDueDateClass = function (event) {

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-11-22 20:50:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry.html	2015-11-27 09:35:48 +0000
@@ -195,7 +195,7 @@
             <div ng-show="currentEvent" class='remove-default-padding overflow-ellipsis'>
                 <div class='row'><hr></div>
                 <div class="add-default-padding">
-                    <textarea class="form-control" rows="3" ng-model="note" placeholder="{{'add_new_note_here'| translate}}"></textarea> 
+                    <textarea class="form-control" rows="3" ng-model="note.value" placeholder="{{'add_new_note_here'| translate}}"></textarea> 
                     <div class="vertical-spacing">
                         <button type="button" 
                                 class="btn btn-primary"
@@ -213,10 +213,10 @@
                     <tr ng-repeat="note in currentEvent.notes">
                         <td class="add-default-left-padding">
                             <d2-pop-over content="note" template="popover.html" details="{{'details'| translate}}">
-                                <!--div>{{note.value}}</div -->
+                                <div>{{note.heading}}</div>
                             </d2-pop-over>
                             <script type="text/ng-template" id="popover.html">
-                                <p>{{content.value}}</p>
+                                <div class="wrap-text">{{content.value}}</div>
                                 <hr>
                                 <p><strong>{{'created_by' | translate}}: </strong>{{content.storedBy}}</p>
                                 <p><strong>{{'date' | translate}}: </strong>{{content.storedDate}}</p>                           

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js	2015-11-21 11:27:43 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes-controller.js	2015-11-27 09:35:48 +0000
@@ -13,6 +13,7 @@
 
     var today = DateUtils.getToday();
     
+    $scope.note = {};
     $scope.showMessagingDiv = false;
     $scope.showNotesDiv = true;
     
@@ -49,31 +50,29 @@
     });
        
     $scope.addNote = function(){
-        
-        if(!angular.isUndefined($scope.note) && $scope.note !== ""){
-            
-            var newNote = {value: $scope.note};
+        if ($scope.note.value !== "" || !angular.isUndefined($scope.note.value)) {
+            var newNote = {value: $scope.note.value};
 
             if(angular.isUndefined( $scope.selectedEnrollment.notes) ){
-                $scope.selectedEnrollment.notes = [{value: $scope.note, storedDate: DateUtils.formatFromUserToApi(today), storedBy: storedBy}];
+                $scope.selectedEnrollment.notes = [{value: newNote.value, storedDate: DateUtils.formatFromUserToApi(today), storedBy: storedBy}];
                 
             }
             else{
-                $scope.selectedEnrollment.notes.splice(0,0,{value: $scope.note, storedDate: DateUtils.formatFromUserToApi(today), storedBy: storedBy});
+                $scope.selectedEnrollment.notes.splice(0,0,{value: newNote.value, storedDate: DateUtils.formatFromUserToApi(today), storedBy: storedBy});
             }
 
             var e = angular.copy($scope.selectedEnrollment);
 
             e.notes = [newNote];
             EnrollmentService.updateForNote(e).then(function(){
-                $scope.note = '';
+                $scope.note = {};
                 $scope.addNoteField = false; //note is added, hence no need to show note field.                
             });
         }        
     };
     
     $scope.clearNote = function(){
-         $scope.note = '';           
+        $scope.note = {};
     };
     
     $scope.showNotes = function(){

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html	2015-11-21 09:55:13 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/notes/notes.html	2015-11-27 09:35:48 +0000
@@ -23,7 +23,7 @@
             <div ng-show="!selectedEnrollment" class="alert alert-danger">{{'not_yet_enrolled_note'| translate}}</div>
             <div ng-show='selectedEnrollment' class='remove-default-padding overflow-ellipsis'>                
                 <div class="add-default-padding">
-                    <textarea class="form-control" rows="3" ng-model="note" placeholder="{{'add_new_note_here'| translate}}"></textarea> 
+                    <textarea class="form-control" rows="3" ng-model="note.value" placeholder="{{'add_new_note_here'| translate}}"></textarea> 
                     <div class="vertical-spacing">
                         <button type="button" 
                                 class="btn btn-primary"
@@ -41,10 +41,10 @@
                     <tr ng-repeat="note in selectedEnrollment.notes| filter:noteSearchText">
                         <td class="add-default-left-padding">
                             <d2-pop-over content="note" template="popover.html" details="{{'details'| translate}}">
-                                <div>{{note.value}}</div>
+                                <div>{{note.heading}}</div>
                             </d2-pop-over>
                             <script type="text/ng-template" id="popover.html">
-                                <p>{{content.value}}</p>
+                                <div class="wrap-text">{{content.value}}</div>
                                 <hr>
                                 <p><strong>{{'created_by' | translate}}: </strong>{{content.storedBy}}</p>
                                 <p><strong>{{'date' | translate}}: </strong>{{content.storedDate}}</p>                           

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2015-11-22 20:50:10 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2015-11-27 09:35:48 +0000
@@ -1186,8 +1186,6 @@
     margin-top: -1px;
 }
 
-
-
 .row.row-striped:nth-of-type(odd) {
     background: #ebf0f6;   
 }
@@ -1213,4 +1211,8 @@
 
 .table-striped > tbody > tr:nth-child(odd)> td.current-event-td {
     background-color: inherit;        
-}   
\ No newline at end of file
+}   
+
+.wrap-text {
+    word-wrap: break-word;
+}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-11-25 13:43:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-11-27 09:35:48 +0000
@@ -85,9 +85,10 @@
         link: function (scope, element, attrs) {
             var content = $templateCache.get("popover.html");
             content = $compile(content)(scope);
+            scope.content.heading = scope.content.value && scope.content.value.length > 20 ? scope.content.value.substring(0,20).concat('...') : scope.content.value;
             var options = {
                 content: content,
-                placement: 'bottom',
+                placement: 'auto',
                 trigger: 'hover',
                 html: true,
                 title: scope.title