hide selected watchers

stable
Juanfran 2014-07-22 09:26:23 +02:00
parent 97762f21ff
commit a285eba6a8
2 changed files with 8 additions and 1 deletions

View File

@ -124,7 +124,13 @@ module.directive("tgLbCreateIssue", [
AddWatcherDirective = -> AddWatcherDirective = ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$scope.usersSearch = {} $scope.usersSearch = {}
watchers = []
updateScopeFilteringUsers = () ->
$scope.filteredUsers = _.difference($scope.users, watchers)
$scope.$on "watcher:add", -> $scope.$on "watcher:add", ->
updateScopeFilteringUsers()
$el.removeClass("hidden") $el.removeClass("hidden")
$scope.$apply -> $scope.$apply ->
$scope.usersSearch = {} $scope.usersSearch = {}
@ -140,6 +146,7 @@ AddWatcherDirective = ->
event.preventDefault() event.preventDefault()
target = angular.element(event.currentTarget) target = angular.element(event.currentTarget)
watcher = target.scope().user watcher = target.scope().user
watchers.push watcher
$el.addClass("hidden") $el.addClass("hidden")
$scope.$broadcast("watcher:added", watcher) $scope.$broadcast("watcher:added", watcher)

View File

@ -6,7 +6,7 @@ form
input(type="text", data-maxlength="500", placeholder="Search for users", ng-model="usersSearch.$") input(type="text", data-maxlength="500", placeholder="Search for users", ng-model="usersSearch.$")
div.watchers div.watchers
div.watcher-single(ng-repeat="user in users|filter:usersSearch:strict|limitTo:5 track by user.id") div.watcher-single(ng-repeat="user in filteredUsers|filter:usersSearch:strict|limitTo:5 track by user.id")
div.watcher-avatar div.watcher-avatar
a.avatar(href="", title="Assigned to") a.avatar(href="", title="Assigned to")
img(tg-bo-src="user.photo", tg-bo-alt="user.photo") img(tg-bo-src="user.photo", tg-bo-alt="user.photo")