diff --git a/js/controllers.js b/js/controllers.js index 0f90a91..2d2bed7 100644 --- a/js/controllers.js +++ b/js/controllers.js @@ -284,6 +284,20 @@ monetaControllers.controller('NewTaskCtrl', ['$scope', '$http', '$state', '$stat } }]); +monetaControllers.controller('RestoreTaskCtrl', ['$scope', '$http', '$state', 'config', 'alert', function ($scope, $http, $state, config, alert) { + $scope.restoreTask = function() { + if (confirm("You are about to restore task \"" + $scope.task.name + "\"")) { + $http.put(config.backend + '/tasks/' + $scope.taskId, $scope.task) + .success(function(data, status, headers, config) { + alert.add({'type': 'success', 'message': 'The task has been restored.', 'timeout': 3000}); + $state.go('task.view', { 'taskId': $scope.taskId }, { 'reload': true}); + }).error(function(data, status, headers, config) { + alert.add({'type': 'alert', 'message': 'An error occured, please try again !'}); + }); + } + }; +}]); + monetaControllers.controller('AuditLogCtrl', ['$scope', '$http', 'config', 'alert', function ($scope, $http, config, alert) { fetchLog = function() { from = moment($scope.from).startOf('day').toISOString(); diff --git a/templates/events/moneta-task-created.html b/templates/events/moneta-task-created.html index df29e78..ea0f121 100644 --- a/templates/events/moneta-task-created.html +++ b/templates/events/moneta-task-created.html @@ -1 +1 @@ -
+ diff --git a/templates/events/moneta-task-deleted.html b/templates/events/moneta-task-deleted.html index df29e78..ea0f121 100644 --- a/templates/events/moneta-task-deleted.html +++ b/templates/events/moneta-task-deleted.html @@ -1 +1 @@ - + diff --git a/templates/events/moneta-task-updated.html b/templates/events/moneta-task-updated.html index ce77258..ad4d140 100644 --- a/templates/events/moneta-task-updated.html +++ b/templates/events/moneta-task-updated.html @@ -3,6 +3,6 @@