From 7926a6cbef566ac7086f8cd0acc9eb99dd49e200 Mon Sep 17 00:00:00 2001 From: Zara Date: Mon, 14 Mar 2016 16:52:28 +0000 Subject: [PATCH] Improve 'Tasks Assigned to Me' Currently, we have 'stories assigned to me' on the dashboard, which lists any active story containing a task assigned to the user. This means there can be noise; a story may be active but the user's *tasks* might all be merged or invalid (and some other user has an active task in the story). This patch changes the dashboard to display 'tasks assigned to me', listing only a user's tasks that are todo, in progress, or in review. Change-Id: I81a6504fd26e56a8dff0559816068d711e3c2c4b --- .../controller/dashboard_controller.js | 50 +++++++++++++-- src/app/dashboard/template/dashboard.html | 62 +++++++++++++++---- 2 files changed, 94 insertions(+), 18 deletions(-) diff --git a/src/app/dashboard/controller/dashboard_controller.js b/src/app/dashboard/controller/dashboard_controller.js index dcd0729e..971dea80 100644 --- a/src/app/dashboard/controller/dashboard_controller.js +++ b/src/app/dashboard/controller/dashboard_controller.js @@ -19,15 +19,55 @@ */ angular.module('sb.dashboard').controller('DashboardController', function ($q, $scope, currentUser, Story, SubscriptionList, - SubscriptionEvent) { + SubscriptionEvent, Task) { 'use strict'; - // Load the list of current assigned stories. - $scope.assignedStories = Story.browse({ - assignee_id: currentUser.id, - status: 'active' + // Load the list of current assigned tasks. + + $scope.filterTasks = Task.browse({ + assignee_id: currentUser.id + }, function(tasks) { + var todo = []; + var progress = []; + var review = []; + var invalid = []; + + angular.forEach(tasks, function(task) { + task.type = 'Task'; + if (task.status === 'review') { + review.push(task); + } + else if (task.status === 'todo') { + todo.push(task); + } + else if (task.status === 'inprogress') { + progress.push(task); + } + else { + invalid.push(task); + } + }); + + $scope.reviewTasks = review; + $scope.todoTasks = todo; + $scope.progressTasks = progress; + $scope.invalidTasks = invalid; }); + /** + * Updates the task list. + */ + $scope.updateTask = function (task, fieldName, value) { + + if(!!fieldName) { + task[fieldName] = value; + } + + task.$update(function () { + $scope.showTaskEditForm = false; + }); + }; + $scope.createdStories = Story.browse({ creator_id: currentUser.id, status: 'active' diff --git a/src/app/dashboard/template/dashboard.html b/src/app/dashboard/template/dashboard.html index 5a0d5e51..def74d34 100644 --- a/src/app/dashboard/template/dashboard.html +++ b/src/app/dashboard/template/dashboard.html @@ -56,32 +56,68 @@
- + - + - + + + + + + + + + + + + +
Stories assigned to meTasks assigned to me
- + - -

- - {{story.title}} + + {{task.title}}

-
+ + +

+ + {{task.title}} + +

+
+ + +

+ + {{task.title}} + +

+
- There are no active stories currently assigned to you. + There are no tasks in active stories currently assigned to you.