dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40533
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20571: event-capture: put back own function instead of native angular for detecting input field interaction
------------------------------------------------------------
revno: 20571
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-10-07 16:23:42 +0200
message:
event-capture: put back own function instead of native angular for detecting input field interaction
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/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 13:47:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-10-07 14:23:42 +0000
@@ -966,6 +966,14 @@
}
});
+ $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-10-07 13:47:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/defaultForm.html 2015-10-07 14:23:42 +0000
@@ -34,7 +34,7 @@
name="eventDate"
input-field-id='eventDate'
class="form-control">
- <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 ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" 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="outerForm.latitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ <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>
</td>
</tr>
@@ -64,7 +64,7 @@
d2-coordinate-validator
ng-required="false"
class="form-control"/>
- <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 ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" 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="innerForm.foo.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ <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-form>
</td>
@@ -274,7 +274,7 @@
name="eventDate"
input-field-id='eventDate'
class="form-control">
- <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 ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" 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="outerForm.latitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ <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>
</td>
</tr>
@@ -304,7 +304,7 @@
d2-coordinate-validator
ng-required="false"
class="form-control"/>
- <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 ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" 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="innerForm.foo.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ <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>
<div ng-if="warningMessages[de.dataElement.id]">
{{warningMessages[de.dataElement.id]}}
=== 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-10-07 13:47:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/ec-custom-form.html 2015-10-07 14:23:42 +0000
@@ -22,7 +22,7 @@
name="eventDate"
input-field-id='eventDate'
class="form-control">
- <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 ng-messages="outerForm.eventDate.$error" ng-if="interacted(outerForm.eventDate)" 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="outerForm.latitude.$touched" class="required" ng-messages-include="../dhis-web-commons/angular-forms/error-messages.html">
+ <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>
</td>
</tr>
@@ -51,7 +51,7 @@
d2-coordinate-validator
ng-required="false"
class="form-control"/>
- <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 ng-messages="outerForm.longitude.$error" ng-if="interacted(outerForm.longitude)" 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-10-07 13:47:02 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/views/eventList.html 2015-10-07 14:23:42 +0000
@@ -332,7 +332,7 @@
name="foo"
ng-class="getInputNotifcationClass(eventGridColumn.id,false)"/>
</div>
- <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 ng-messages="innerFormGrid.foo.$error" ng-if="interacted(innerFormGrid.foo)" 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/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-07 13:47:02 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.services.js 2015-10-07 14:23:42 +0000
@@ -443,7 +443,7 @@
}
}
}
- 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>';
+ 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>';
htmlCode = htmlCode.replace(inputField, newInputField);
}
@@ -609,7 +609,7 @@
}
}
- 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>';
+ 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>';
htmlCode = htmlCode.replace(inputField, newInputField);
}