Show all stories created and allows them to filter according to status
This patch shows users all stories created by them in their dashboard regardless of status by default and also gives them the option to filter those stories by status Change-Id: If2edee356afd3436f0ae7c54b486c4e9d9004917 Task: 3091 Signed-off-by: Riju19 <19.riju@gmail.com>
This commit is contained in:
parent
13984cb8de
commit
b1cd0a879a
|
@ -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