use groupsFilter for search.group

This commit is contained in:
Ozzystrasza
2016-09-17 00:23:16 -03:00
parent 998037e0a1
commit f3f4229e49
2 changed files with 6 additions and 6 deletions

View File

@@ -160,7 +160,7 @@ describe('Challenges Controller', function() {
it('filters challenges to a single group when group id filter is set', inject(function($controller) {
scope.search = { };
scope.groups = {
scope.groupsFilter = {
0: specHelper.newGroup({_id: 'group-one'}),
1: specHelper.newGroup({_id: 'group-two'}),
2: specHelper.newGroup({_id: 'group-three'})
@@ -175,7 +175,7 @@ describe('Challenges Controller', function() {
describe('selectAll', function() {
it('sets all groups in seach.group to true', function() {
scope.search = { };
scope.groups = {
scope.groupsFilter = {
0: specHelper.newGroup({_id: 'group-one'}),
1: specHelper.newGroup({_id: 'group-two'}),
2: specHelper.newGroup({_id: 'group-three'})
@@ -193,7 +193,7 @@ describe('Challenges Controller', function() {
describe('selectNone', function() {
it('sets all groups in seach.group to false', function() {
scope.search = { };
scope.groups = {
scope.groupsFilter = {
0: specHelper.newGroup({_id: 'group-one'}),
1: specHelper.newGroup({_id: 'group-two'}),
2: specHelper.newGroup({_id: 'group-three'})

View File

@@ -391,13 +391,13 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
})
$scope.selectAll = function(){
$scope.search.group = _.transform($scope.groups, function(searchPool, group){
$scope.search.group = _.transform($scope.groupsFilter, function(searchPool, group){
searchPool[group._id] = true;
});
}
$scope.selectNone = function(){
$scope.search.group = _.transform($scope.groups, function(searchPool, group){
$scope.search.group = _.transform($scope.groupsFilter, function(searchPool, group){
searchPool[group._id] = false;
});
}
@@ -435,7 +435,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
$scope.groupsFilter = _.uniq(_.compact(_.pluck($scope.challenges, 'group')), function(g) {return g._id});
$scope.search = {
group: _.transform($scope.groups, function(m,g) { m[g._id] = true;}),
group: _.transform($scope.groupsFilter, function(m,g) { m[g._id] = true;}),
_isMember: "either",
_isOwner: "either"
};