Added simple logged-in dashboard
In order to make tasks assigned to individuals more usable, I've added a separate logged-in dashboard view that provides us with a list of all stories that contain a task assigned to the current user. I've also updated the sidebar menu to be labeled 'Dashboard', and added a directive with which we can centralize our layout for story task status. Change-Id: I92c39cf3bae26424ef07f753feebaadb381d0739
This commit is contained in:
parent
f9fde5b5c2
commit
7f8fdf6561
29
src/app/dashboard/controllers/dashboard_controller.js
Normal file
29
src/app/dashboard/controllers/dashboard_controller.js
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* 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 controller that manages our logged-in dashboard
|
||||
*/
|
||||
angular.module('sb.dashboard').controller('DashboardController',
|
||||
function ($scope, currentUser, Story) {
|
||||
'use strict';
|
||||
|
||||
// Load the list of current assigned stories.
|
||||
$scope.assignedStories = Story.query({
|
||||
assignee_id: currentUser.id,
|
||||
status: 'active'
|
||||
});
|
||||
});
|
@ -15,9 +15,14 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Controller for our home(index) page, currently just a placeholder.
|
||||
* Controller for our home(index) page.
|
||||
*/
|
||||
angular.module('sb.dashboard').controller('HomeController',
|
||||
function () {
|
||||
function ($state, sessionState, SessionState) {
|
||||
'use strict';
|
||||
|
||||
// If we're logged in, go to the dashboard instead.
|
||||
if (sessionState === SessionState.LOGGED_IN) {
|
||||
$state.transitionTo('dashboard');
|
||||
}
|
||||
});
|
||||
|
@ -19,7 +19,7 @@
|
||||
*/
|
||||
angular.module('sb.dashboard',
|
||||
[ 'sb.services', 'sb.templates', 'sb.auth', 'ui.router', 'ui.bootstrap'])
|
||||
.config(function ($stateProvider) {
|
||||
.config(function ($stateProvider, SessionResolver) {
|
||||
'use strict';
|
||||
|
||||
// Set an initial home page.
|
||||
@ -27,6 +27,18 @@ angular.module('sb.dashboard',
|
||||
.state('index', {
|
||||
url: '/',
|
||||
templateUrl: 'app/templates/dashboard/index.html',
|
||||
controller: 'HomeController'
|
||||
controller: 'HomeController',
|
||||
resolve: {
|
||||
sessionState: SessionResolver.resolveSessionState
|
||||
}
|
||||
})
|
||||
.state('dashboard', {
|
||||
url: '/dashboard',
|
||||
templateUrl: 'app/templates/dashboard/dashboard.html',
|
||||
controller: 'DashboardController',
|
||||
resolve: {
|
||||
sessionState: SessionResolver.requireLoggedIn,
|
||||
currentUser: SessionResolver.requireCurrentUser
|
||||
}
|
||||
});
|
||||
});
|
||||
|
36
src/app/templates/dashboard/dashboard.html
Normal file
36
src/app/templates/dashboard/dashboard.html
Normal file
@ -0,0 +1,36 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<h1>Dashboard</h1>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<th colspan="2">Stories assigned to me</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="story in assignedStories">
|
||||
<td class="col-sm-2">
|
||||
<story-status-label story="story"/>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<a href="#!/story/{{story.id}}">
|
||||
{{story.title}}
|
||||
</a>
|
||||
</p>
|
||||
<story-task-status story="story"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody ng-show="assignedStories.length == 0">
|
||||
<td colspan="3" class="text-center text-muted">
|
||||
<em>
|
||||
There are no active stories currently assigned to you.
|
||||
</em>
|
||||
</td>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -27,9 +27,9 @@
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-pilltabs nav-stacked">
|
||||
<li active-path="^\/$">
|
||||
<li active-path="^\/(dashboard)?$">
|
||||
<a href="#!/">
|
||||
<span class="hidden-xs">Overview</span>
|
||||
<span class="hidden-xs">Dashboard</span>
|
||||
<i class="fa fa-home visible-xs"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
26
src/app/templates/util/story_task_status.html
Normal file
26
src/app/templates/util/story_task_status.html
Normal file
@ -0,0 +1,26 @@
|
||||
<small>
|
||||
<span class="badge"
|
||||
ng-class="{'badge-primary': story.todo > 0}">
|
||||
{{story.todo}}
|
||||
</span> ToDo
|
||||
|
||||
<span class="badge"
|
||||
ng-class="{'badge-primary': story.inprogress > 0}">
|
||||
{{story.inprogress}}
|
||||
</span> In Progress
|
||||
|
||||
<span class="badge"
|
||||
ng-class="{'badge-primary': story.review > 0}">
|
||||
{{story.review}}
|
||||
</span> In Review
|
||||
|
||||
<span class="badge"
|
||||
ng-class="{'badge-primary': story.merged > 0}">
|
||||
{{story.merged}}
|
||||
</span> Merged
|
||||
|
||||
<span class="badge"
|
||||
ng-class="{'badge-primary': story.invalid > 0}">
|
||||
{{story.invalid}}
|
||||
</span> Invalid
|
||||
</small>
|
32
src/app/util/directive/story_task_status.js
Normal file
32
src/app/util/directive/story_task_status.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
*
|
||||
* 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 story status label that automatically selects color and text based on
|
||||
* the bound-in story.
|
||||
*/
|
||||
angular.module('sb.util').directive('storyTaskStatus',
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/templates/util/story_task_status.html',
|
||||
scope: {
|
||||
story: '='
|
||||
}
|
||||
};
|
||||
});
|
@ -1,6 +1,9 @@
|
||||
// Bootstrap extension that adds colors to badges
|
||||
|
||||
.badge {
|
||||
&.badge-primary {
|
||||
background-color: @brand-primary;
|
||||
}
|
||||
|
||||
&.badge-info {
|
||||
background-color: @brand-info;
|
||||
|
Loading…
x
Reference in New Issue
Block a user