From 11331ef260de1db15bc60450ff7259614478085a Mon Sep 17 00:00:00 2001 From: Riju19 <19.riju@gmail.com> Date: Fri, 8 Mar 2019 11:21:55 +0530 Subject: [PATCH] Make task ordering in Story view selectable This patch gives users the option of ordering tasks in story view on the basis of id,title or status. Task: 28150 Change-Id: I4fcf53c647fdf5302176a023179285b5707a9f26 --- .../controller/story_detail_controller.js | 23 ++++++++ src/app/stories/template/detail.html | 55 +++++++++++++------ 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/app/stories/controller/story_detail_controller.js b/src/app/stories/controller/story_detail_controller.js index 4aa09855..754890fd 100644 --- a/src/app/stories/controller/story_detail_controller.js +++ b/src/app/stories/controller/story_detail_controller.js @@ -60,6 +60,29 @@ angular.module('sb.story').controller('StoryDetailController', $scope.projects = {}; $scope.tasks = tasks; + /** + * Allowing sorting tasks in search results by certain fields. + */ + $scope.tasks_sort_field = { + label: 'Id', + value: 'id' + }; + $scope.changeOrder = function(orderBy){ + $scope.tasks_sort_field.label = orderBy.toString(); + switch(orderBy) { + case 'Id': + $scope.tasks_sort_field.value = 'id'; + break; + case 'Status': + $scope.tasks_sort_field.value = 'status'; + break; + case 'Title': + $scope.tasks_sort_field.value = 'title'; + break; + } + }; + + function mapTaskToProject(task) { Project.get({id: task.project_id}).$promise.then(function(project) { var idx = $scope.projectNames.indexOf(project.name); diff --git a/src/app/stories/template/detail.html b/src/app/stories/template/detail.html index 35d7cc18..10c8911e 100644 --- a/src/app/stories/template/detail.html +++ b/src/app/stories/template/detail.html @@ -391,6 +391,25 @@