← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21760: Enhancement of delete button clickability

 

------------------------------------------------------------
revno: 21760
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2016-01-15 15:44:59 +0100
message:
  Enhancement of delete button clickability
modified:
  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


--
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-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-01-14 17:28:46 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/dataentry-controller.js	2016-01-15 14:44:59 +0000
@@ -27,7 +27,6 @@
                 TrackerRulesFactory,
                 EventCreationService,
                 $q,$location) {
-
     $scope.printForm = false;
     $scope.printEmptyForm = false;
     $scope.eventPageSize = 4;
@@ -379,7 +378,6 @@
                             note.storedDate = DateUtils.formatToHrsMins(note.storedDate);
                         });
                     }
-
                     var eventStage = $scope.stagesById[dhis2Event.programStage];
                     if (angular.isObject(eventStage)) {
                         dhis2Event.name = eventStage.name;
@@ -1894,7 +1892,7 @@
         }
     };
     
-    $scope.deleteFile = function(dataElement){
+    $scope.deleteFile = function(ev, dataElement){
         
         if( !dataElement ){            
             var dialogOptions = {
@@ -1915,6 +1913,7 @@
         ModalService.showModal({}, modalOptions).then(function(result){            
             $scope.fileNames[$scope.currentEvent.event][dataElement] = null;
             $scope.currentEvent[dataElement] = null;
+            ev[dataElement] = null;
             $scope.saveDatavalue($scope.prStDes[dataElement], null);
             //$scope.updateEventDataValue($scope.currentEvent, dataElement);
         });

=== 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-01-14 13:38:30 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dataentry/default-form.html	2016-01-15 14:44:59 +0000
@@ -288,13 +288,15 @@
                                         <a href ng-click="downloadFile(currentEvent.event, prStDe.dataElement.id)">{{fileNames[currentEvent.event][prStDe.dataElement.id]}}</a>
                                     </div>
                                     <span class="input-group-btn">
-                                        <span class="btn btn-primary btn-file">
+                                        <span class="btn btn-primary btn-file" ng-if="currentEvent[prStDe.dataElement.id]" ng-click="deleteFile(currentEvent,prStDe.dataElement.id)">
                                             <span ng-if="currentEvent[prStDe.dataElement.id]"
                                                   title="{{'delete' | translate}}"
                                                   d2-file-input-name="fileNames[currentEvent.event][prStDe.dataElement.id]"
                                                   d2-file-input-delete="currentEvent[prStDe.dataElement.id]">
-                                                <a href ng-click="deleteFile(prStDe.dataElement.id)"><i class="fa fa-trash alert-danger"></i></a>
+                                                <i class="fa fa-trash"></i><
                                             </span>
+                                        </span>
+                                        <span class="btn btn-primary btn-file" ng-if="!currentEvent[prStDe.dataElement.id]">
                                             <span ng-if="!currentEvent[prStDe.dataElement.id]" title="{{'upload' | translate}}">
                                                 <i class="fa fa-upload"></i>
                                                 <input type="file"
@@ -634,14 +636,16 @@
                                                     <a href ng-click="downloadFile(currentEvent.event, de.dataElement.id)">{{fileNames[currentEvent.event][de.dataElement.id]}}</a>
                                                 </div>
                                                     <span class="input-group-btn">
-                                                        <span class="btn btn-primary btn-file">
-                                                            <span ng-if="currentEvent[de.dataElement.id]"
+                                                        <span class="btn btn-primary btn-file" ng-click="deleteFile(currentEvent,de.dataElement.id)" ng-if="currentEvent[de.dataElement.id]">
+                                                            <span
                                                                   title="{{'delete' | translate}}"
                                                                   d2-file-input-name="fileNames[currentEvent.event][de.dataElement.id]"
                                                                   d2-file-input-delete="currentEvent[de.dataElement.id]">
-                                                                <a href ng-click="deleteFile(de.dataElement.id)"><i class="fa fa-trash alert-danger"></i></a>
+                                                                <i class="fa fa-trash"></i>
                                                             </span>
-                                                            <span ng-if="!currentEvent[de.dataElement.id]" title="{{'upload' | translate}}">
+                                                        </span>
+                                                        <span class="btn btn-primary btn-file" ng-if="!currentEvent[de.dataElement.id]">
+                                                            <span title="{{'upload' | translate}}">
                                                                 <i class="fa fa-upload"></i>
                                                                 <input type="file"
                                                                        ng-required={{prStDes[de.dataElement.id].compulsory}}