Add option to show boards with specific user. Fixes #94.

This commit is contained in:
kiswa 2015-03-22 13:03:16 -04:00
parent 454921c984
commit 6a8558d037
3 changed files with 27 additions and 3 deletions

View File

@ -519,7 +519,7 @@ span.filter {
.board-status {
font-weight: normal;
display: inline-block;
min-width: 50px;
min-width: 70px;
}
#change-password, #default-board, #change-username {
width: 48%;

View File

@ -43,7 +43,8 @@ function ($scope, $interval, BoardService) {
{ filter: 'active', name: 'Active' },
{ filter: 'inactive', name: 'Inactive' },
],
filter: 'all'
filter: 'all',
userFilter: null
};
$scope.boardsFilter = function(element) {
@ -57,6 +58,23 @@ function ($scope, $interval, BoardService) {
}
};
$scope.boardsUserFilter = function(element) {
if (null === $scope.boardFilter.userFilter) {
return true;
}
var retVal = false;
element.sharedUser.forEach(function(user) {
console.log(user.id === $scope.boardFilter.userFilter);
if (user.id === $scope.boardFilter.userFilter) {
retVal = true;
}
});
return retVal;
};
$scope.toggleActiveState = function(boardId) {
BoardService.toggleActiveState(boardId)
.success(function(data) {

View File

@ -1,5 +1,11 @@
<div class="widget-content">
<h4>Current Boards
<span class="small pull-right form-group form-inline filter">Show By User:
<select class="form-control" data-ng-model="boardFilter.userFilter"
data-ng-options="user.id as user.username for user in users">
<option value="">Any User</option>
</select>
</span>
<span class="small pull-right form-group form-inline filter">Filter By:
<select class="form-control" data-ng-model="boardFilter.filter"
data-ng-options="option.filter as option.name for option in boardFilter.options">
@ -26,7 +32,7 @@
<td data-ng-if="currentUser.isAdmin == '0'" colspan="5" align="center">You are not assigned to any boards. Contact an admin user to be added to a board.</td>
<td data-ng-if="currentUser.isAdmin == '1'" colspan="5" align="center">There are no current boards. Use the <strong>Add Board</strong> button below to add one.</td>
</tr>
<tr data-ng-repeat="board in boards | orderBy:boardSort.sort | filter:boardsFilter">
<tr data-ng-repeat="board in boards | orderBy:boardSort.sort | filter:boardsFilter | filter:boardsUserFilter">
<td><a title="Go To Board" href="#/boards/{{ board.id }}">{{ board.name }}</a></td>
<td>
<ul class="list-group">