Merge "Improve 'Tasks Assigned to Me'"
This commit is contained in:
commit
ca3c217aed
@ -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'
|
||||
|
@ -59,32 +59,68 @@
|
||||
<div class="col-sm-6">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th colspan="2">Stories assigned to me</th>
|
||||
<th colspan="2">Tasks assigned to me</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="story in assignedStories">
|
||||
<tr ng-repeat="task in progressTasks">
|
||||
<td class="col-sm-2">
|
||||
<story-status-label story="story"/>
|
||||
<task-status-dropdown
|
||||
editable="{{isLoggedIn}}"
|
||||
on-change="updateTask(task, 'status', status)"
|
||||
status="{{task.status}}"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<subscribe class="pull-right"
|
||||
resource="story"
|
||||
resource-id="story.id"
|
||||
subscriptions="storySubscriptions">
|
||||
</subscribe>
|
||||
<p>
|
||||
<a href="#!/story/{{story.id}}">
|
||||
{{story.title}}
|
||||
<a href="#!/story/{{task.story_id}}">
|
||||
{{task.title}}
|
||||
</a>
|
||||
</p>
|
||||
<story-task-status story="story"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody ng-show="assignedStories.length == 0">
|
||||
<tbody>
|
||||
<tr ng-repeat="task in todoTasks">
|
||||
<td class="col-sm-2">
|
||||
<task-status-dropdown
|
||||
editable="{{isLoggedIn}}"
|
||||
on-change="updateTask(task, 'status', status)"
|
||||
status="{{task.status}}"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a href="#!/story/{{task.story_id}}">
|
||||
{{task.title}}
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr ng-repeat="task in reviewTasks">
|
||||
<td class="col-sm-2">
|
||||
<task-status-dropdown
|
||||
editable="{{isLoggedIn}}"
|
||||
on-change="updateTask(task, 'status', status)"
|
||||
status="{{task.status}}"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a href="#!/story/{{task.story_id}}">
|
||||
{{task.title}}
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody ng-show="todoTasks.length == 0 &&
|
||||
progressTasks.length == 0 &&
|
||||
reviewTasks.length == 0">
|
||||
<td colspan="3" class="text-center text-muted">
|
||||
<em>
|
||||
There are no active stories currently assigned to you.
|
||||
There are no tasks in active stories currently assigned to you.
|
||||
</em>
|
||||
</td>
|
||||
</tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user