← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20569: event-capture: replaced detection of input field interaction with native angualr function

 

------------------------------------------------------------
revno: 20569
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-07 15:47:02 +0200
message:
  event-capture: replaced detection of input field interaction with native angualr function
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js
  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/ec-custom-form.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/error-messages.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.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/scripts/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-10-07 08:51:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js	2015-10-07 13:47:02 +0000
@@ -966,14 +966,6 @@
         }
     });
     
-    $scope.interacted = function(field) {
-        var status = false;
-        if(field){            
-            status = $scope.outerForm.submitted || field.$dirty;
-        }
-        return status;        
-    };
-    
     //listen for rule effect changes    
     $scope.$on('ruleeffectsupdated', function(event, args) {
         $scope.warningMessages = [];

=== 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	2015-09-25 13:33:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html	2015-10-07 13:47:02 +0000
@@ -34,7 +34,7 @@
                            name="eventDate" 
                            input-field-id='eventDate' 
                            class="form-control">
-                    <div ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
+                    <div ng-messages="outerForm.eventDate.$error" ng-if="outerForm.eventDate.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
                     </div>
                 </td>
             </tr>
@@ -49,7 +49,7 @@
                            d2-coordinate-validator
                            ng-required="false"
                            class="form-control"/>
-                    <div ng-messages="outerForm.latitude.$error" ng-if="interacted(outerForm.latitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                        
+                    <div ng-messages="outerForm.latitude.$error" ng-if="outerForm.latitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                        
                     </div>
                 </td>                                            
             </tr>
@@ -64,7 +64,7 @@
                            d2-coordinate-validator
                            ng-required="false"
                            class="form-control"/>
-                    <div ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+                    <div ng-messages="outerForm.longitude.$error" ng-if="outerForm.longitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
                     </div>
                 </td>                                                            
             </tr>            
@@ -239,7 +239,7 @@
                                     class="form-control"> 
                             </div>
                         </div>                        
-                        <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
+                        <div ng-messages="innerForm.foo.$error" ng-if="innerForm.foo.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
                         </div>                        
                     </ng-form>                    
                 </td>
@@ -274,7 +274,7 @@
                            name="eventDate" 
                            input-field-id='eventDate' 
                            class="form-control">
-                    <div ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
+                    <div ng-messages="outerForm.eventDate.$error" ng-if="outerForm.eventDate.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
                     </div>
                 </td>
             </tr>
@@ -289,7 +289,7 @@
                            d2-coordinate-validator
                            ng-required="false"
                            class="form-control"/>
-                    <div ng-messages="outerForm.latitude.$error" ng-if="interacted(outerForm.latitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                        
+                    <div ng-messages="outerForm.latitude.$error" ng-if="outerForm.latitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                        
                     </div>
                 </td>                                            
             </tr>
@@ -304,7 +304,7 @@
                            d2-coordinate-validator
                            ng-required="false"
                            class="form-control"/>
-                    <div ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+                    <div ng-messages="outerForm.longitude.$error" ng-if="outerForm.longitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
                     </div>
                 </td>                                            
             </tr>        
@@ -504,7 +504,7 @@
                                         class="form-control"/> 
                                 </div>
                             </div>                        
-                            <div ng-messages="innerForm.foo.$error" ng-if="interacted(innerForm.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
+                            <div ng-messages="innerForm.foo.$error" ng-if="innerForm.foo.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
                             </div>
                             <div ng-if="warningMessages[de.dataElement.id]">
                                 {{warningMessages[de.dataElement.id]}}
@@ -516,8 +516,4 @@
         </table>
     </div> 
 
-</div>
-
-
-<!--<div ng-include="'views/comments-section.html'"></div>
-<div ng-include="'views/buttons-section.html'"></div>-->
\ No newline at end of file
+</div>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html	2015-09-25 13:33:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html	2015-10-07 13:47:02 +0000
@@ -22,7 +22,7 @@
                     name="eventDate" 
                     input-field-id='eventDate' 
                     class="form-control">
-            <div ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
+            <div ng-messages="outerForm.eventDate.$error" ng-if="outerForm.eventDate.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                                         
             </div>
         </td>
     </tr>
@@ -36,7 +36,7 @@
                    d2-coordinate-validator
                    ng-required="false"
                    class="form-control"/>
-            <div ng-messages="outerForm.latitude.$error" ng-if="interacted(outerForm.latitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                        
+            <div ng-messages="outerForm.latitude.$error" ng-if="outerForm.latitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">                        
             </div>
         </td>                                            
     </tr>
@@ -51,7 +51,7 @@
                    d2-coordinate-validator
                    ng-required="false"
                    class="form-control"/>
-            <div ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+            <div ng-messages="outerForm.longitude.$error" ng-if="outerForm.longitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
             </div>
         </td>                                                            
     </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2015-09-25 13:33:59 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html	2015-10-07 13:47:02 +0000
@@ -332,7 +332,7 @@
                                                                name="foo" 
                                                                ng-class="getInputNotifcationClass(eventGridColumn.id,false)"/>                                                    
                                                 </div>
-                                                <div ng-messages="innerFormGrid.foo.$error" ng-if="interacted(innerFormGrid.foo)" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+                                                <div ng-messages="innerFormGrid.foo.$error" ng-if="innerFormGrid.foo.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
                                                 </div>
                                             </div>
                                         </div>                                                                            

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/error-messages.html'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/error-messages.html	2015-09-22 14:58:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/angular-forms/error-messages.html	2015-10-07 13:47:02 +0000
@@ -9,3 +9,4 @@
 <span ng-message="optionValidator">{{'option_required' | translate}}</span>
 <span ng-message="latitudeValidator">{{'latitude_required' | translate}}</span>
 <span ng-message="longitudeValidator">{{'longitude_required' | translate}}</span>
+<span ng-message="uniqunessValidator">{{'longitude_required' | translate}}</span>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-10-06 10:52:09 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js	2015-10-07 13:47:02 +0000
@@ -443,7 +443,7 @@
                                 }
                             }
                         }
-                        newInputField = newInputField + ' <span ng-messages="outerForm.' + fieldId + '.$error" class="required" ng-if="interacted(outerForm.' + fieldId + ')" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"></span>';
+                        newInputField = newInputField + ' <span ng-messages="outerForm.' + fieldId + '.$error" class="required" ng-if="outerForm.' + fieldName + '.$touched" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"></span>';
 
                         htmlCode = htmlCode.replace(inputField, newInputField);
                     }
@@ -609,7 +609,7 @@
                         }
                     }
 
-                    newInputField = newInputField + ' <span ng-messages="outerForm.' + fieldName + '.$error" class="required" ng-if="interacted(outerForm.' + fieldName + ')" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"></span>';
+                    newInputField = newInputField + ' <span ng-messages="outerForm.' + fieldName + '.$error" class="required" ng-if="outerForm.' + fieldName + '.$touched" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html"></span>';
 
                     htmlCode = htmlCode.replace(inputField, newInputField);
                 }