Make the Add Lane button show the new worklist modal

This allows new lanes to be made automatic at creation time easily.

Change-Id: Ie62ae2630142e1930135c2b5a4285e0510715170
This commit is contained in:
Adam Coldrick 2016-04-15 10:24:34 +00:00
parent 50bf116e81
commit 8aa490ae6c
4 changed files with 32 additions and 12 deletions

View File

@ -160,14 +160,28 @@ angular.module('sb.board').controller('BoardDetailController',
* Add a lane to the board.
*/
$scope.addLane = function () {
$scope.board.lanes.push({
worklist: new Worklist({
id: null,
title: '',
editing: true
}),
position: $scope.board.lanes.length,
board_id: $scope.board.id
var modalInstance = $modal.open({
size: 'lg',
templateUrl: 'app/worklists/template/new.html',
controller: 'AddWorklistController',
resolve: {
params: function() {
return {};
},
redirect: function() {
return false;
}
}
});
modalInstance.result.then(function(worklist) {
$scope.board.lanes.push({
list_id: worklist.id,
worklist: Worklist.get({id: worklist.id}),
position: $scope.board.lanes.length,
board_id: $scope.board.id
});
Board.update($scope.board);
});
};

View File

@ -18,7 +18,7 @@
* Controller for the "new worklist" modal popup.
*/
angular.module('sb.worklist').controller('AddWorklistController',
function ($scope, $modalInstance, $state, params, Worklist) {
function ($scope, $modalInstance, $state, params, redirect, Worklist) {
'use strict';
var blankFilter = {
@ -39,8 +39,11 @@ angular.module('sb.worklist').controller('AddWorklistController',
$scope.worklist.$create(
function (result) {
$scope.isSaving = false;
$modalInstance.dismiss('success');
$state.go('sb.worklist.detail', {worklistID: result.id});
$modalInstance.close(result);
if (redirect) {
$state.go('sb.worklist.detail',
{worklistID: result.id});
}
}
);
};

View File

@ -34,6 +34,9 @@ angular.module('sb.worklist').factory('NewWorklistService',
return {
userId: userId || null
};
},
redirect: function() {
return true;
}
}
}

View File

@ -112,7 +112,7 @@
</td>
<td class="text-right">
<a href class="close"
ng-click="remove(criterion)">&times;</a>
ng-click="remove(filter)">&times;</a>
</td>
</tr>
<tr ng-show="showAddFilter">