diff --git a/src/app/project_group/controller/project_group_detail_controller.js b/src/app/project_group/controller/project_group_detail_controller.js index 96efd5e8..a22a8e1a 100644 --- a/src/app/project_group/controller/project_group_detail_controller.js +++ b/src/app/project_group/controller/project_group_detail_controller.js @@ -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(); }); diff --git a/src/app/project_group/module.js b/src/app/project_group/module.js index 05ad2cdb..fe8157f8 100644 --- a/src/app/project_group/module.js +++ b/src/app/project_group/module.js @@ -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; } } }); diff --git a/src/app/project_group/template/detail.html b/src/app/project_group/template/detail.html index ff9ae004..9af4b6fb 100644 --- a/src/app/project_group/template/detail.html +++ b/src/app/project_group/template/detail.html @@ -36,23 +36,52 @@
+ + | + + +No stories found. |