Skip to content

Commit

Permalink
Ask confirmation to user when he leaves without saving examination data
Browse files Browse the repository at this point in the history
  • Loading branch information
JocelynDelalande committed Jun 15, 2018
1 parent bd1e648 commit 69b6504
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libreosteoweb/static/js/app/editformmanager.js
Expand Up @@ -149,7 +149,7 @@ editFormManager.directive('editFormControl', ['$timeout', function($timeout) {
attr.saveOnLostFocus = false;
}
},
controller: ['$scope', 'loEditFormManager', '$element', function($scope, loEditFormManager, $element) {
controller: ['$scope', '$routeParams', 'loEditFormManager', '$element', function($scope, $routeParams, loEditFormManager, $element) {
var actions = [];
if ($scope.save != null) {
actions.push(new Callback('save', $scope.save));
Expand Down Expand Up @@ -192,12 +192,17 @@ editFormManager.directive('editFormControl', ['$timeout', function($timeout) {
}
}

// tab change
$scope.$on('uiTabChange', function(event) {
// :visible is a hack to figure out if we are current tab.
if ($element.is(':visible')) {
handleUnsavedForm(event, false);
}
});
// router view change
$scope.$on('$locationChangeStart', function(event) {
handleUnsavedForm(event, true);
});
}],
}
}]);
Expand Down

0 comments on commit 69b6504

Please sign in to comment.