Add a page to view all of your subscriptions

This commit adds a dashboard which lists all the things you
are subscribed to. This makes it easier to unsubscribe from
resources, as the user doesn't need to visit lots of different
pages in order to unsubscribe from different things.

Change-Id: I300f9e6f8077d0cf96864428df7cd5af6111b575
This commit is contained in:
Adam Coldrick 2015-12-14 17:38:39 +00:00
parent 61e2e002c6
commit 1924579628
6 changed files with 191 additions and 1 deletions

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2015 Codethink Ltd.
*
* 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.
*/
/**
* Subscriptions controller. Provides a view of all subscribed objects.
*/
angular.module('sb.dashboard').controller('DashboardSubscriptionsController',
function ($scope, Story, Project, ProjectGroup, SubscriptionList,
currentUser) {
'use strict';
$scope.storySubscriptions = SubscriptionList.subsList(
'story', currentUser);
$scope.stories = Story.browse({subscriber_id: currentUser.id});
$scope.projectSubscriptions = SubscriptionList.subsList(
'project', currentUser);
$scope.projects = Project.browse({subscriber_id: currentUser.id});
$scope.projectGroupSubscriptions = SubscriptionList.subsList(
'project_group', currentUser);
$scope.projectGroups = ProjectGroup.browse(
{subscriber_id: currentUser.id});
});

View File

@ -57,5 +57,10 @@ angular.module('sb.dashboard',
url: '/boards',
controller: 'BoardsWorklistsController',
templateUrl: 'app/dashboard/template/boards_worklists.html'
})
.state('sb.dashboard.subscriptions', {
url: '/subscriptions',
templateUrl: 'app/dashboard/template/subscriptions.html',
controller: 'DashboardSubscriptionsController'
});
});

View File

@ -24,4 +24,9 @@
<i class="fa fa-tasks fa-lg"></i>
</a>
</li>
<li active-path="^\/dashboard/subscriptions.*">
<a href="#!/dashboard/subscriptions" title="Subscriptions">
<i class="fa fa-star fa-lg"></i>
</a>
</li>
</ul>

View File

@ -0,0 +1,136 @@
<!--
~ Copyright (c) 2015 Codethink Ltd.
~
~ 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.
-->
<div class="container-fluid" ng-hide="isLoading">
<div class="row">
<div class="col-xs-12">
<view-title>Subscriptions</view-title>
<h1><i class="fa fa-star"
ng-if="!saving"></i>
<i class="fa fa-spin fa-star"
ng-if="saving"></i>
Subscriptions
</h1>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<table class="table table-striped">
<thead>
<th colspan="2">
<i class="fa fa-sb-story fa-lg"></i>
Stories
</th>
</thead>
<tbody>
<tr ng-repeat="story in stories">
<td class="col-sm-2">
<story-status-label story="story"/>
</td>
<td>
<subscribe class="pull-right"
resource="story"
resource-id="story.id"
subscriptions="storySubscriptions">
</subscribe>
<p>
<a href="#!/story/{{story.id}}">
{{story.title}}
</a>
</p>
<story-task-status story="story"/>
</td>
</tr>
</tbody>
<tbody ng-show="stories.length == 0">
<td colspan="3" class="text-center text-muted">
<em>
You are not currently subscribed to any stories.
</em>
</td>
</tbody>
</table>
</div>
<div class="col-sm-6">
<hr class="visible-xs"/>
<table class="table table-striped">
<thead>
<th>
<i class="fa fa-sb-project fa-lg"></i>
Projects
</th>
</thead>
<tbody>
<tr ng-repeat="project in projects">
<td>
<subscribe class="pull-right"
resource="project"
resource-id="project.id"
subscriptions="projectSubscriptions">
</subscribe>
<p>
<a href="#!/project/{{project.id}}">
{{project.name}}
</a>
</p>
</td>
</tr>
</tbody>
<tbody ng-show="projects.length == 0">
<td colspan="3" class="text-center text-muted">
<em>
You are not currently subscribed to any projects.
</em>
</td>
</tbody>
</table>
</div>
<div class="col-sm-6">
<hr class="visible-xs"/>
<table class="table table-striped">
<thead>
<th>
<i class="fa fa-sb-project-group fa-lg"></i>
Project Groups
</th>
</thead>
<tbody>
<tr ng-repeat="projectGroup in projectGroups">
<td>
<subscribe class="pull-right"
resource="project_group"
resource-id="projectGroup.id"
subscriptions="projectGroupSubscriptions">
</subscribe>
<p>
<a href="#!/project_group/{{projectGroup.id}}">
{{projectGroup.name}}
</a>
</p>
</td>
</tr>
</tbody>
<tbody ng-show="projectGroups.length == 0">
<td colspan="3" class="text-center text-muted">
<em>
You are not currently subscribed to any project groups.
</em>
</td>
</tbody>
</table>
</div>
</div>
</div>

View File

@ -20,7 +20,6 @@
<i class="fa fa-sb-profile-preferences fa-lg"></i>
</a>
</li>
<li active-path="^\/profile/tokens.*">
<a href="#!/profile/tokens" title="Authentication Tokens">
<i class="fa fa-sb-profile-tokens fa-lg"></i>
</a>

View File

@ -105,6 +105,13 @@
<i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="#!/dashboard/subscriptions">
<i class="fa fa-star"></i>
Subscriptions
</a>
</li>
<li role="separator" class="divider"></li>
<li>
<a href="#!/auth/deauthorize">
<i class="fa fa-sign-out"></i>