fix for multiple guilds creation

This commit is contained in:
Matteo Pagliazzi
2013-11-26 20:16:10 +01:00
parent 878bfc7f46
commit 860a084c69

View File

@@ -198,8 +198,10 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
} }
$scope.type = 'guild'; $scope.type = 'guild';
$scope.text = 'Guild'; $scope.text = 'Guild';
$scope.newGroup = new Groups.Group({type:'guild', privacy:'private', leader: User.user._id, members: [User.user._id]}); var newGroup = function(){
return new Groups.Group({type:'guild', privacy:'private', leader: User.user._id, members: [User.user._id]});
}
$scope.newGroup = newGroup()
$scope.create = function(group){ $scope.create = function(group){
if (User.user.balance < 1) return $rootScope.modals.buyGems = true; if (User.user.balance < 1) return $rootScope.modals.buyGems = true;
@@ -209,6 +211,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
$scope.groups.guilds.push(saved); $scope.groups.guilds.push(saved);
if(saved.privacy === 'public') $scope.groups.public.push(saved); if(saved.privacy === 'public') $scope.groups.public.push(saved);
$state.go('options.social.guilds.detail', {gid: saved._id}); $state.go('options.social.guilds.detail', {gid: saved._id});
$scope.newGroup = newGroup();
}); });
} }
} }