diff --git a/src/app/boards/controller/board_detail_controller.js b/src/app/boards/controller/board_detail_controller.js index 3ecb888c..baf464a5 100644 --- a/src/app/boards/controller/board_detail_controller.js +++ b/src/app/boards/controller/board_detail_controller.js @@ -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); }); }; diff --git a/src/app/worklists/controller/add_worklist_controller.js b/src/app/worklists/controller/add_worklist_controller.js index 2611e4eb..63f26c27 100644 --- a/src/app/worklists/controller/add_worklist_controller.js +++ b/src/app/worklists/controller/add_worklist_controller.js @@ -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}); + } } ); }; diff --git a/src/app/worklists/service/new_worklist_service.js b/src/app/worklists/service/new_worklist_service.js index b894ff31..ae3347b8 100644 --- a/src/app/worklists/service/new_worklist_service.js +++ b/src/app/worklists/service/new_worklist_service.js @@ -34,6 +34,9 @@ angular.module('sb.worklist').factory('NewWorklistService', return { userId: userId || null }; + }, + redirect: function() { + return true; } } } diff --git a/src/app/worklists/template/new.html b/src/app/worklists/template/new.html index b96b031f..45e8124c 100644 --- a/src/app/worklists/template/new.html +++ b/src/app/worklists/template/new.html @@ -112,7 +112,7 @@