diff --git a/src/app/stories/controller/story_detail_controller.js b/src/app/stories/controller/story_detail_controller.js index 438f3087..94562cec 100644 --- a/src/app/stories/controller/story_detail_controller.js +++ b/src/app/stories/controller/story_detail_controller.js @@ -623,6 +623,18 @@ angular.module('sb.story').controller('StoryDetailController', task.editing = false; }; + $scope.showAddWorklist = function(task) { + $modal.open({ + templateUrl: 'app/stories/template/add_task_to_worklist.html', + controller: 'StoryTaskAddWorklistController', + resolve: { + task: function() { + return task; + } + } + }); + }; + /** * Removes this task */ diff --git a/src/app/stories/controller/story_task_add_worklist_controller.js b/src/app/stories/controller/story_task_add_worklist_controller.js new file mode 100644 index 00000000..b8647aaf --- /dev/null +++ b/src/app/stories/controller/story_task_add_worklist_controller.js @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Codethink Ltd. + * + * Licensed under the Apache License, Version 2.0 (the 'License'); you may + * not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + */ + +/** + * Controller for "Add task to worklist" modal. + */ +angular.module('sb.story').controller('StoryTaskAddWorklistController', + function ($log, $scope, $state, task, $modalInstance, Worklist) { + 'use strict'; + + $scope.task = task; + $scope.defaultCriteria = []; + + $scope.selected = 'none'; + + $scope.select = function(worklist) { + $scope.selected = worklist; + }; + + $scope.add = function() { + var params = { + item_id: task.id, + id: $scope.selected.id, + list_position: $scope.selected.items.length, + item_type: 'task' + }; + + Worklist.ItemsController.create(params, function(item) { + $modalInstance.dismiss(item); + }); + }; + + $scope.close = function () { + $modalInstance.dismiss('cancel'); + }; + } +); diff --git a/src/app/stories/template/add_task_to_worklist.html b/src/app/stories/template/add_task_to_worklist.html new file mode 100644 index 00000000..bfceea52 --- /dev/null +++ b/src/app/stories/template/add_task_to_worklist.html @@ -0,0 +1,93 @@ + +
+
+ +

Add "{{task.title}}" to worklist

+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + +
Select a Worklist
{{ worklist.id }}: {{ worklist.title }}
+
+
+
+
+
+ + +
+
+
+
+
diff --git a/src/app/stories/template/detail.html b/src/app/stories/template/detail.html index c67f9461..8b2570b0 100644 --- a/src/app/stories/template/detail.html +++ b/src/app/stories/template/detail.html @@ -428,6 +428,10 @@ ng-click="changingProject = !changingProject"> {{ changingProject ? 'Cancel' : 'Change project' }} +