Add a route to redirect from a Task ID to the relevant Story
This allows tasks to be broadly located given just a Task ID. Change-Id: I9c275a3cab711ca4b7f3968f9bfbae754270ca34 Story: 2001626 Task: 24369
This commit is contained in:
parent
2d00cd8127
commit
114b4e2ce3
|
@ -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', {
|
||||
|
|
|
@ -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});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue