WIP(party-page): Broken multi-invite

This commit is contained in:
Sabe Jones
2015-08-10 15:16:45 -05:00
parent beacce7fe0
commit 5b15d603aa
3 changed files with 10 additions and 8 deletions

View File

@@ -116,6 +116,7 @@
"byColon": "By:", "byColon": "By:",
"inviteNewUsers": "Invite New Users", "inviteNewUsers": "Invite New Users",
"sendInvitations": "Send Invitations", "sendInvitations": "Send Invitations",
"invitationsSent": "Invitations sent!",
"inviteAlertInfo2": "Or share this link (copy/paste):", "inviteAlertInfo2": "Or share this link (copy/paste):",
"sendGiftHeading": "Send Gift to <%= name %>", "sendGiftHeading": "Send Gift to <%= name %>",
"sendGiftGemsBalance": "From <%= number %> Gems", "sendGiftGemsBalance": "From <%= number %> Gems",

View File

@@ -139,11 +139,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
$scope.inviter = User.user.profile.name; $scope.inviter = User.user.profile.name;
$scope.emails = [{name:"",email:""},{name:"",email:""}]; $scope.emails = [{name:"",email:""},{name:"",email:""}];
$scope.invitees = [{invitee:""},{invitee:""}]; $scope.invitees = [{uuid:""},{uuid:""}];
$scope.inviteEmails = function(){ $scope.inviteEmails = function(){
Groups.Group.invite({gid: $scope.group._id}, {inviter: $scope.inviter, emails: $scope.emails}, function(){ Groups.Group.invite({gid: $scope.group._id}, {inviter: $scope.inviter, emails: $scope.emails}, function(){
Notification.text("Invitation(s) sent!"); Notification.text(window.env.t('invitationsSent'));
$scope.emails = [{name:'',email:''},{name:'',email:''}]; $scope.emails = [{name:'',email:''},{name:'',email:''}];
}, function(){ }, function(){
$scope.emails = [{name:'',email:''},{name:'',email:''}]; $scope.emails = [{name:'',email:''},{name:'',email:''}];
@@ -151,11 +151,12 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
}; };
$scope.invite = function(){ $scope.invite = function(){
Groups.Group.invite({gid: $scope.group._id}, {uuids: [$scope.invitee]}, function(){ var uuidList = _.pluck($scope.invitees,'uuid');
Notification.text("Invitation(s) sent!"); Groups.Group.invite({gid: $scope.group._id}, {uuids: uuidList}, function(){
$scope.invitee = ''; Notification.text(window.env.t('invitationsSent'));
$scope.invitees = [{uuid:""},{uuid:""}];
}, function(){ }, function(){
$scope.invitee = ''; $scope.invitees = [{uuid:""},{uuid:""}];
}); });
}; };
}]) }])

View File

@@ -39,10 +39,10 @@ script(type='text/ng-template', id='modals/invite-friends.html')
tbody tbody
tr(ng-repeat='invitee in invitees') tr(ng-repeat='invitee in invitees')
td td
input.form-control(type='text', ng-model='invitee.invitee') input.form-control(type='text', ng-model='invitee.uuid')
tr tr
td(colspan=2) td(colspan=2)
a.btn.btn-xs.pull-right(ng-click='invitees = invitees.concat([{invitee:""}])') a.btn.btn-xs.pull-right(ng-click='invitees = invitees.concat([{uuid:""}])')
i.glyphicon.glyphicon-plus i.glyphicon.glyphicon-plus
tr tr
td td