diff --git a/src/app/storyboard/module.js b/src/app/storyboard/module.js index f3424f95..03b93cb8 100644 --- a/src/app/storyboard/module.js +++ b/src/app/storyboard/module.js @@ -26,7 +26,7 @@ angular.module('storyboard', [ 'sb.services', 'sb.templates', 'sb.dashboard', 'sb.pages', 'sb.projects', 'sb.auth', 'sb.story', 'sb.profile', 'sb.notification', 'sb.search', 'sb.admin', 'sb.subscription', 'sb.project_group', 'sb.worklist', - 'sb.board', 'sb.due_date', 'ui.router', 'ui.bootstrap', + 'sb.board', 'sb.due_date', 'sb.task', 'ui.router', 'ui.bootstrap', 'monospaced.elastic', 'angularMoment', 'angular-data.DSCacheFactory', 'viewhead', 'ngSanitize', 'as.sortable']) .constant('angularMomentConfig', { diff --git a/src/app/tasks/module.js b/src/app/tasks/module.js new file mode 100644 index 00000000..e157aa46 --- /dev/null +++ b/src/app/tasks/module.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 Adam Coldrick + * + * 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. + */ + +/** + * A tiny submodule for handling task navigation. Currently just redirects + * /task/:id to the relevant story. + */ +angular.module('sb.task', ['ui.router']) + .config(function ($stateProvider) { + 'use strict'; + + $stateProvider + .state('sb.task', { + url: '/task/{taskId:[0-9]+}', + resolve: { + redirect: function (Task, $stateParams, $q, $state) { + Task.get({ + id: $stateParams.taskId + }).$promise.then(function (task) { + $state.go('sb.story.detail', + {storyId: task.story_id}); + }); + } + } + }); + } +);