← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22008: Added icons that provide information on data elements in event capture.

 

------------------------------------------------------------
revno: 22008
committer: jijukjose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-02-19 13:07:47 +0100
message:
  Added icons that provide information on data elements in event capture.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties
  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/defaultForm.html
  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/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties	2016-01-25 10:14:50 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/i18n/i18n_app.properties	2016-02-19 12:07:47 +0000
@@ -164,4 +164,6 @@
 audit_modified=Modified By
 audit_history_unavailable=There are no previous values stored, so audit history is not available for
 audit_history=Audit History
-delete_error_audit=The event could not be deleted because it contains an auditlog.
\ No newline at end of file
+delete_error_audit=The event could not be deleted because it contains an auditlog.
+description=Description
+url=URL

=== 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	2016-02-12 15:42:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2016-02-19 12:07:47 +0000
@@ -540,4 +540,16 @@
 
 .fa-icon-width {
     width: 15px;
+}
+
+.info-icon {
+    color: #3162C5;
+    width:14px;
+    height: 14px;
+    cursor: pointer;
+}
+
+.popover {
+    max-width:400px;
+    pointer-events:none;
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2016-02-12 15:42:21 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2016-02-19 12:07:47 +0000
@@ -17,9 +17,12 @@
             <tr ng-repeat="eventGridColumn in eventGridColumns" ng-if="eventGridColumn.id !== 'comment' && eventGridColumn.id !== 'uid' && eventGridColumn.id !== 'eventDate' && !hiddenFields[eventGridColumn.id]">
                 <td >
                     {{eventGridColumn.displayName}}
-                    <span ng-if="eventGridColumn.compulsory" class="required">*</span>                    
+                    <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDes[de.dataElement.id].dataElement.description}}"},
+                                            {"name":"{{"url" | translate}}", "data":"{{prStDes[de.dataElement.id].dataElement.url}}"}]'>
+                    </d2-info>
+                    <span ng-if="eventGridColumn.compulsory" class="required">*</span>
                 </td>
-                <td >
+                <td>
                     <ng-form name="innerForm">
                         <div ng-if="prStDes[eventGridColumn.id].dataElement.optionSetValue">
                             <div ng-if="!selectedProgram.dataEntryMethod || optionSets[prStDes[eventGridColumn.id].dataElement.optionSet.id].options.length >= 7">
@@ -269,11 +272,15 @@
                     </th>
                 </tr>                        
             </thead>
-            <tbody>       
+            <tbody>
                 <tr ng-repeat="de in section.programStageDataElements" ng-if="!hiddenFields[de.dataElement.id]">
-                    <td >
-                        {{prStDes[de.dataElement.id].dataElement.formName ? prStDes[de.dataElement.id].dataElement.formName : prStDes[de.dataElement.id].dataElement.displayName}}                         
-                        <span ng-if="prStDes[de.dataElement.id].compulsory" class="required">*</span>                        
+                    <td>
+                        {{prStDes[de.dataElement.id].dataElement.formName ? prStDes[de.dataElement.id].dataElement.formName : prStDes[de.dataElement.id].dataElement.displayName}}
+
+                        <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDes[de.dataElement.id].dataElement.description}}"},
+                                                {"name":"{{"url" | translate}}", "data":"{{prStDes[de.dataElement.id].dataElement.url}}"}]'>
+                        </d2-info>
+                        <span ng-if="prStDes[de.dataElement.id].compulsory" class="required">*</span>
                     </td>
                     <td>
                         <ng-form name="innerForm">

=== 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	2016-02-12 15:42:21 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2016-02-19 12:07:47 +0000
@@ -625,4 +625,50 @@
             }],
         link: function (scope, element, attrs) {}
     };
+}).directive('d2Info',function($translate){
+    var showIcon = true;
+    return {
+        restrict: 'EA',
+        template:'<span type="button" class="glyphicon glyphicon-info-sign info-icon" data-container="body" data-toggle="popover"'+
+        'data-placement="right" data-html="true" data-title="{{title}}" data-content="{{formattedContent}}"></span>',
+        scope: {
+            title:'@?',
+            content:'@'
+        },
+        link: function(scope,element, attrs) {
+            scope.formattedContent = getFormattedContent(scope.content);
+            $('body').on('click', function (e) {
+                scope.$apply();
+
+                $('[data-toggle="popover"]').each(function () {
+                    if (!$(this).is(e.target)) {
+                        $(this).popover('hide');
+                    } else {
+                        if(showIcon) {
+                            $(this).popover('show');
+                            showIcon=false;
+                        }
+                    }
+                });
+            });
+
+            function getFormattedContent(contentArrayString) {
+                var contentArray = $.parseJSON(contentArrayString);
+                var formattedString = "";
+                for (var index = 0; index < contentArray.length; index++) {
+                    var content = contentArray[index];
+                    if (!content.data) {
+                        content.data="Not available";
+                    }
+                    if (content.name === $translate.instant('url') && content.data !== "Not available") {
+                        formattedString += '<div><b>'+ content.name + ': </b><a href=' + content.data + ' target=\'_blank\' style=\'cursor:pointer;pointer-events:auto;\'>' + content.data + '</a></div>';
+
+                    } else {
+                        formattedString += '<div><b>' + content.name + ': </b>' + content.data + '</div>';
+                    }
+                }
+                return formattedString;
+            }
+        }
+    }
 });
\ No newline at end of file