diff --git a/src/app/dashboard/controller/dashboard_controller.js b/src/app/dashboard/controller/dashboard_controller.js index f090c846..d69ab061 100644 --- a/src/app/dashboard/controller/dashboard_controller.js +++ b/src/app/dashboard/controller/dashboard_controller.js @@ -69,10 +69,50 @@ angular.module('sb.dashboard').controller('DashboardController', }; $scope.createdStories = Story.browse({ - creator_id: currentUser.id, - status: 'active' + creator_id: currentUser.id }); + + /** + * Filter the stories. + */ + $scope.showActive = true; + $scope.showMerged = true; + $scope.showInvalid = true; + + /** + * 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 (status.length === 0) { + $scope.createdStories = []; + return; + } + + Story.browse({ + sort_field: 'id', + sort_dir: 'desc', + status: status, + creator_id: currentUser.id + }, + function (result) { + $scope.createdStories = result; + } + ); + }; + + function loadEvents() { // Load the user's subscription events. $scope.subscriptionEvents = null; diff --git a/src/app/dashboard/template/dashboard.html b/src/app/dashboard/template/dashboard.html index 06a40c5f..b5f8d6ad 100644 --- a/src/app/dashboard/template/dashboard.html +++ b/src/app/dashboard/template/dashboard.html @@ -93,6 +93,33 @@
+
+ + + + +

Stories created by me

@@ -113,7 +140,7 @@

- There are no active stories created by you. + There are no stories created by you.