[#1837] separate groups filter from "create new challenge"-available groups

This commit is contained in:
Tyler Renelle
2013-11-15 17:36:36 -08:00
parent c9ddc0e023
commit 05334550b0
2 changed files with 3 additions and 2 deletions

View File

@@ -4,9 +4,10 @@ habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notifica
function($scope, User, Challenges, Notification, $compile, Groups, $state) {
// FIXME $scope.challenges needs to be resolved first (see app.js)
$scope.groups = Groups.Group.query({type:'party,guilds,tavern'});
Challenges.Challenge.query(function(challenges){
$scope.challenges = challenges;
$scope.groups = _.uniq(_.pluck(challenges, 'group'), function(g){return g._id});
$scope.groupsFilter = _.uniq(_.pluck(challenges, 'group'), function(g){return g._id});
$scope.search = {
group: _.transform($scope.groups, function(m,g){m[g._id]=true;})
};

View File

@@ -65,7 +65,7 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
a.btn.btn-mini.pull-left(ng-click='selectAll()') All
a.btn.btn-mini(ng-click='selectNone()') None
br
label.checkbox(ng-repeat='group in groups')
label.checkbox(ng-repeat='group in groupsFilter')
input(type='checkbox', ng-model='search.group[group._id]')
| {{group.name}}
h4 Membership