Project Group detail page improvements.

List of stories is now filterable by status, and is sorted in reverse
unique ID order (most recent created first). Overall a fairly trivial
change, but it makes the project group page much more useful.

Change-Id: I1c4b9814e0da891b1fe18ec8e737f21611b2595c
This commit is contained in:
Michael Krotscheck 2015-03-30 11:20:07 -07:00
parent 4a92d916c2
commit 9ff3916e32
3 changed files with 77 additions and 21 deletions

View File

@ -19,7 +19,7 @@
* projects, and any stories that belong under this project group.
*/
angular.module('sb.project_group').controller('ProjectGroupDetailController',
function ($scope, projectGroup, projects, stories) {
function ($scope, projectGroup, projects, Story) {
'use strict';
/**
@ -41,5 +41,43 @@ angular.module('sb.project_group').controller('ProjectGroupDetailController',
*
* @type [Story]
*/
$scope.stories = stories;
$scope.stories = [];
/**
* Filter the stories.
*/
$scope.showActive = true;
$scope.showMerged = false;
$scope.showInvalid = false;
/**
* Reload the stories in this view based on user selected filters.
*/
$scope.filterStories = function () {
var status = [];
if ($scope.showActive) {
status.push('active');
}
if ($scope.showMerged) {
status.push('merged');
}
if ($scope.showInvalid) {
status.push('invalid');
}
// If we're asking for nothing, just return a [];
if (status.length === 0) {
$scope.stories = [];
return;
}
$scope.stories = Story.query({
project_group_id: projectGroup.id,
sort_field: 'id',
sort_dir: 'desc',
status: status
});
};
$scope.filterStories();
});

View File

@ -69,17 +69,6 @@ angular.module('sb.project_group',
deferred.reject(error);
});
return deferred.promise;
},
stories: function($stateParams, Story, $q) {
var deferred = $q.defer();
Story.query({project_group_id: $stateParams.id},
function (result) {
deferred.resolve(result);
}, function (error) {
deferred.reject(error);
});
return deferred.promise;
}
}
});

View File

@ -36,23 +36,52 @@
<div class="col-xs-12">
<hr/>
</div>
<div class="col-xs-2 text-center text-muted">
<span class="hidden-xs">
<i class="fa fa-3x fa-sb-story"></i>
<div class="col-xs-2">
<div class="text-center text-muted">
<span class="hidden-xs">
<i class="fa fa-3x fa-sb-story"></i>
<br/>
<small>Stories</small>
</span>
<i class="fa fa-2x fa-sb-story visible-xs"></i>
</div>
<div class="col-xs-12 col-sm-6 col-sm-offset-2 col-md-offset-3">
<br/>
<small>Stories</small>
</span>
<i class="fa fa-2x fa-sb-story visible-xs"></i>
<div class="checkbox label label-info">
<input type="checkbox"
ng-model="showActive"
ng-change="filterStories()"/>
Active
</div>
<div class="checkbox label label-success">
<input type="checkbox"
ng-model="showMerged"
ng-change="filterStories()"/>
Merged
</div>
<div class="checkbox label label-default">
<input type="checkbox"
ng-model="showInvalid"
ng-change="filterStories()"/>
Invalid
</div>
</div>
</div>
<div class="col-xs-10">
<table class="table table-condensed table-striped table-clean">
<tbody ng-if="stories.length != 0">
<tbody ng-if="stories.length > 0">
<tr ng-repeat="story in stories"
ng-include="'app/search/template/story_search_item.html'">
</tr>
</tbody>
<tbody ng-if="stories.length == 0">
<tbody ng-if="!stories.$resolved && (showMerged || showInvalid || showActive)">
<td class="text-center text-muted">
<i class="fa fa-refresh fa-spin"></i>
</td>
</tbody>
<tbody ng-if="stories.length == 0 && (stories.$resolved || !(showMerged || showInvalid || showActive))">
<td class="text-center text-muted">
<em>No stories found.</em>
</td>