dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40069
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20292: event-capture: better detection of unsaved data
------------------------------------------------------------
revno: 20292
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-09-22 13:55:28 +0200
message:
event-capture: better detection of unsaved data
modified:
dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.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-09-21 16:09:31 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/controllers.js 2015-09-22 11:55:28 +0000
@@ -412,7 +412,7 @@
$scope.cancel = function(){
- if($scope.formHasUnsavedData()){
+ if($scope.formIsChanged()){
var modalOptions = {
closeButtonText: 'no',
actionButtonText: 'yes',
@@ -803,7 +803,7 @@
var isChanged = false;
for(var i=0; i<$scope.selectedProgramStage.programStageDataElements.length && !isChanged; i++){
var deId = $scope.selectedProgramStage.programStageDataElements[i].dataElement.id;
- if($scope.currentEvent[deId] && $scope.currentEventOriginialValue[deId] !== $scope.currentEvent[deId]){
+ if($scope.currentEventOriginialValue[deId] !== $scope.currentEvent[deId]){
isChanged = true;
}
}
@@ -844,13 +844,6 @@
return formIsInvalid;
};
-
- $scope.formHasUnsavedData = function(){
- if(angular.isObject($scope.currentEvent) && angular.isObject($scope.currentEventOriginialValue)){
- return !angular.equals($scope.currentEvent, $scope.currentEventOriginialValue);
- }
- return false;
- };
//watch for event editing
$scope.$watchCollection('[editingEventInFull, eventRegistration]', function() {