Ask for confirmation when archiving a board's lane

Its easy to accidentally archive a lane, we should check for
the user's confirmation first.

Change-Id: I87c25d94da35ab61eecfdf1207d6e3af3869d7b7
This commit is contained in:
Adam Coldrick
2016-01-15 13:35:21 +00:00
parent b8a8845b4d
commit 9e166d1a8a
3 changed files with 22 additions and 7 deletions

View File

@@ -174,9 +174,21 @@ angular.module('sb.board').controller('BoardDetailController',
* Remove a lane from the board.
*/
$scope.removeLane = function (worklist) {
var idx = $scope.board.worklists.indexOf(worklist);
$scope.board.worklists.splice(idx, 1);
worklist.$delete();
var modalInstance = $modal.open({
templateUrl: 'app/worklists/template/delete.html',
controller: 'WorklistDeleteController',
resolve: {
worklist: function() {
return worklist;
},
redirect: false
}
});
modalInstance.result.then(function() {
var idx = $scope.board.worklists.indexOf(worklist);
$scope.board.worklists.splice(idx, 1);
});
};
/**

View File

@@ -18,7 +18,7 @@
* Controller for "delete worklist" modal
*/
angular.module('sb.worklist').controller('WorklistDeleteController',
function ($log, $scope, $state, worklist, $modalInstance) {
function ($log, $scope, $state, worklist, redirect, $modalInstance) {
'use strict';
$scope.worklist = worklist;
@@ -30,8 +30,10 @@ angular.module('sb.worklist').controller('WorklistDeleteController',
$scope.remove = function () {
$scope.worklist.$delete(
function () {
$modalInstance.dismiss('success');
$state.go('sb.dashboard.boards');
if (!!redirect) {
$state.go('sb.dashboard.boards');
}
return $modalInstance.close('success');
}
);
};

View File

@@ -141,7 +141,8 @@ angular.module('sb.worklist').controller('WorklistDetailController',
resolve: {
worklist: function() {
return $scope.worklist;
}
},
redirect: true
}
});
return modalInstance.result;