Merge "Show all stories created and allows them to filter according to status"
This commit is contained in:
commit
c06f2ca51d
|
@ -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;
|
||||
|
|
|
@ -93,6 +93,33 @@
|
|||
<!-- stories created block-->
|
||||
<div class="col-sm-6">
|
||||
<div class="card">
|
||||
<div class="pull-right">
|
||||
<span class="dropdown form-control-static" dropdown="">
|
||||
<button class="btn btn-xs btn-default" dropdown-toggle="" aria-haspopup="true" aria-expanded="true">
|
||||
<li class="dropdown-header">Filter stories</li>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li>
|
||||
<input type="checkbox"
|
||||
ng-model="showActive"
|
||||
ng-change="filterStories()"/>
|
||||
Active
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox"
|
||||
ng-model="showMerged"
|
||||
ng-change="filterStories()"/>
|
||||
Merged
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox"
|
||||
ng-model="showInvalid"
|
||||
ng-change="filterStories()"/>
|
||||
Invalid
|
||||
</li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<h3>Stories created by me</h3>
|
||||
<div class="card-row" ng-repeat="story in createdStories">
|
||||
<span class="pull-right">
|
||||
|
@ -113,7 +140,7 @@
|
|||
<p ng-show="createdStories.length == 0"
|
||||
class="card-row text-center text-muted">
|
||||
<em>
|
||||
There are no active stories created by you.
|
||||
There are no stories created by you.
|
||||
</em>
|
||||
</p>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue