← Back to team overview

dhis2-devs team mailing list archive

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

 

------------------------------------------------------------
revno: 22013
committer: jijukjose <jijukjose@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-02-19 17:53:52 +0100
message:
  Added icons that provide information on data elements in tracker capture.
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-tracker-capture/components/dataentry/compare-form.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/default-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties
  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	2016-02-19 12:07:47 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/styles/style.css	2016-02-19 16:53:52 +0000
@@ -542,6 +542,7 @@
     width: 15px;
 }
 
+/*classes for the details icon on dataelements*/
 .info-icon {
     color: #3162C5;
     width:14px;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/compare-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/compare-form.html	2016-02-15 09:46:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/compare-form.html	2016-02-19 16:53:52 +0000
@@ -162,9 +162,9 @@
                         <span ng-bind="prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.displayName"></span>
                         <span ng-if="prStDe.compulsory" class="required">*</span>
                         <span class="hideInPrint">
-                            <a ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}" ng-init="showHelpText[prStDe.dataElement.id] = false;" ng-click="showHelpText[prStDe.dataElement.id] = !showHelpText[prStDe.dataElement.id]">
-                                <span class="glyphicon glyphicon-info-sign" ></span>
-                                <span ng-show="showHelpText[prStDe.dataElement.id]" ><br>{{prStDe.dataElement.description}}</span>
+                            <a ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}">
+                                <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDe.dataElement.description}}"}]'>
+                                </d2-info>
                             </a>                        
                         </span>                       
                     </div>
@@ -306,9 +306,9 @@
                                         <span ng-bind="prStDes[de.dataElement.id].dataElement.formName ? prStDes[de.dataElement.id].dataElement.formName : prStDes[de.dataElement.id].dataElement.displayName"></span>                                
                                         <span ng-if="prStDes[de.dataElement.id].compulsory" class="required">*</span>
                                         <span class="hideInPrint">
-                                            <a ng-if="prStDes[de.dataElement.id].dataElement.description" Title="{{prStDes[de.dataElement.id].dataElement.description}}" ng-init="showHelpText[de.dataElement.id] = false;" ng-click="showHelpText[de.dataElement.id] = !showHelpText[de.dataElement.id]">
-                                                <span class="glyphicon glyphicon-info-sign" ></span>
-                                                <span ng-show="showHelpText[de.dataElement.id]" ><br>{{prStDes[de.dataElement.id].dataElement.description}}</span>
+                                            <a ng-if="prStDes[de.dataElement.id].dataElement.description" Title="{{prStDes[de.dataElement.id].dataElement.description}}">
+                                                <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDes[de.dataElement.id].dataElement.description}}"}]'>
+                                                </d2-info>
                                             </a>                                       
                                         </span>          
                                     </div>

=== 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	2016-02-15 12:05:18 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2016-02-19 16:53:52 +0000
@@ -45,7 +45,6 @@
     $scope.showEventsAsTables = false;
     //variable is set while looping through the program stages later.
     $scope.stagesCanBeShownAsTable = false;
-    $scope.showHelpText = {};
     $scope.hiddenFields = [];
     $scope.assignedFields = [];
     $scope.errorMessages = {};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2016-02-15 09:46:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2016-02-19 16:53:52 +0000
@@ -17,9 +17,9 @@
                 <span ng-bind="prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.displayName"></span>
                 <span ng-if="prStDe.compulsory" class="required">*</span>
                 <span class="hideInPrint">
-                    <a ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}" ng-init="showHelpText[prStDe.dataElement.id] = false;" ng-click="showHelpText[prStDe.dataElement.id] = !showHelpText[prStDe.dataElement.id]">
-                        <span class="glyphicon glyphicon-info-sign" ></span>
-                        <span ng-show="showHelpText[prStDe.dataElement.id]" ><br>{{prStDe.dataElement.description}}</span>
+                    <a ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}">
+                        <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDe.dataElement.description}}"}]'>
+                        </d2-info>
                     </a>
                     <span ng-if="otherValuesLists[prStDe.dataElement.id]" ng-repeat="altValue in otherValuesLists[prStDe.dataElement.id] track by $index">
                         <span class="label label-default">{{altValue | translate}}</span>
@@ -51,9 +51,9 @@
             <accordion-group is-open="section.open" ng-repeat='section in currentStage.programStageSections' ng-if="!hiddenSections[currentEvent.event][section.id]" style="overflow:visible">
                 <accordion-heading>
                     {{section.displayName}}
-                    <a ng-if="section.description" Title="{{section.description}}" ng-init="showHelpText.sections[section.id] = false;" ng-click="showHelpText.sections[section.id] = !showHelpText.sections[section.id];section.open =!section.open;">
-                        <span class="glyphicon glyphicon-info-sign" ></span>
-                        <span ng-show="showHelpText.sections[section.id]" ><br>{{section.description}}</span>
+                    <a ng-if="section.description" Title="{{section.description}}" ng-click="section.open =!section.open;">
+                        <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{section.description}}"}]'>
+                        </d2-info>
                     </a>
                 </accordion-heading>
                 
@@ -80,9 +80,9 @@
                                 <span ng-bind="prStDes[de.dataElement.id].dataElement.formName ? prStDes[de.dataElement.id].dataElement.formName : prStDes[de.dataElement.id].dataElement.displayName"></span>       
                                 <span ng-if="prStDes[de.dataElement.id].compulsory" class="required">*</span>
                                 <span class="hideInPrint">
-                                    <a ng-if="prStDes[de.dataElement.id].dataElement.description" Title="{{prStDes[de.dataElement.id].dataElement.description}}" ng-init="showHelpText[de.dataElement.id] = false;" ng-click="showHelpText[de.dataElement.id] = !showHelpText[de.dataElement.id]">
-                                        <span class="glyphicon glyphicon-info-sign" ></span>
-                                        <span ng-show="showHelpText[de.dataElement.id]" ><br>{{prStDes[de.dataElement.id].dataElement.description}}</span>
+                                    <a ng-if="prStDes[de.dataElement.id].dataElement.description" Title="{{prStDes[de.dataElement.id].dataElement.description}}">
+                                        <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDes[de.dataElement.id].dataElement.description}}"}]'>
+                                        </d2-info>
                                     </a>   
                                     <span ng-if="otherValuesLists[de.dataElement.id] && showOtherValuesLists" ng-repeat="altValue in otherValuesLists[de.dataElement.id]">
                                         <span class="label label-default">{{altValue | translate}}</span>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html	2016-02-15 09:46:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/table-entry-form.html	2016-02-19 16:53:52 +0000
@@ -66,9 +66,9 @@
                     <th class="" ng-repeat="prStDe in currentStage.programStageDataElements">
                         {{prStDe.dataElement.formName ? prStDe.dataElement.formName : prStDe.dataElement.displayName}}
                         <span ng-if="prStDe.compulsory" class="required">*</span>
-                        <a href ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}" ng-init="showHelpText[prStDe.dataElement.id] = false;" ng-click="showHelpText[prStDe.dataElement.id] = !showHelpText[prStDe.dataElement.id]">
-                            <span class="glyphicon glyphicon-info-sign" ></span>
-                            <span ng-show="showHelpText[prStDe.dataElement.id]" ><br>{{prStDe.dataElement.description}}</span>
+                        <a href ng-if="prStDe.dataElement.description" Title="{{prStDe.dataElement.description}}">
+                            <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{prStDe.dataElement.description}}"}]'>
+                            </d2-info>
                         </a>
                     </th>
                     <th class="" style="text-align: right">Status</th>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2016-02-15 09:46:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/default-registration-form.html	2016-02-19 16:53:52 +0000
@@ -3,9 +3,9 @@
     <tr ng-repeat="attribute in attributes | filter: {attribute: 'true'} " ng-if="!hiddenFields[attribute.id] && ((editingDisabled  && attribute.show) || !editingDisabled)">
         <td>
             <span ng-bind="attribute.displayName"></span><span ng-if="attribute.mandatory || attribute.unique" class="required">*</span>
-            <a ng-if="attribute.description" Title="{{attribute.description}}" ng-click="showHelpText(attribute.id)">
-                <span class="glyphicon glyphicon-info-sign" ></span>
-                <span ng-show="helpTexts[attribute.id]" ><br>{{attribute.description}}</span>
+            <a ng-if="attribute.description" Title="{{attribute.description}}">
+                <d2-info data-content='[{"name":"{{"description" | translate}}", "data":"{{attribute.description}}"}]'>
+                </d2-info>
             </a>
         </td>
         <td>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2016-02-15 09:46:27 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/registration/registration-controller.js	2016-02-19 16:53:52 +0000
@@ -34,10 +34,7 @@
     
     $scope.helpTexts = {};
     
-    $scope.showHelpText = function(attributeId){
-        $scope.helpTexts[attributeId] = $scope.helpTexts[attributeId] ? false : true;
-    };
-    
+
     $scope.attributesById = CurrentSelection.getAttributesById();
     if(!$scope.attributesById){
         $scope.attributesById = [];

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2016-02-15 12:05:18 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/i18n/i18n_app.properties	2016-02-19 16:53:52 +0000
@@ -465,4 +465,6 @@
 events_in_two_weeks=Events due in two weeks
 events_in_one_month=Events due in a month
 choose_the_dates=Choose the dates
-fill_all_category_options=Please fill all category options
\ No newline at end of file
+fill_all_category_options=Please fill all category options
+description=Description
+url=URL
\ No newline at end of file

=== 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	2016-02-17 13:08:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/styles/style.css	2016-02-19 16:53:52 +0000
@@ -1925,4 +1925,17 @@
 .row-with-go-button {
     margin-top: 46%;
     margin-left: 1%;
+}
+
+/*classes for the details icon on dataelements*/
+.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-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-19 12:07:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2016-02-19 16:53:52 +0000
@@ -616,59 +616,74 @@
                     }
                     $scope.elementClicked = false;
                 };
-                
-                if(angular.isDefined($scope.preSelected) && $scope.preSelected === true){                    
+
+                if(angular.isDefined($scope.preSelected) && $scope.preSelected === true){
                     $document.on('click', $scope.documentClick);
                     $scope.documentEventListenerSet = true;
                 }
-                
+
             }],
-        link: function (scope, element, attrs) {}
+        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>';
-                    }
+}).directive('d2Info', function ($translate) {
+        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) {
+                var showIcon = true;
+
+
+                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;
+                            }
+                        }
+                    });
+                });
+
+                element.on('$destroy', function (e) {
+                    $('[data-toggle="popover"]').each(function () {
+                        if (!e.target) {
+                            alert("No target");
+                        }
+                        if (!$(this).is(e.target)) {
+                            $(this).popover('hide');
+                        }
+                    });
+                });
+
+
+                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;
                 }
-                return formattedString;
             }
         }
-    }
-});
\ No newline at end of file
+    });
\ No newline at end of file