mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
WIP(party-page): Roll back to 1x invites
Also a draft of logic for 1-step create group + invite people.
This commit is contained in:
@@ -139,7 +139,29 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
|
||||
|
||||
$scope.inviter = User.user.profile.name;
|
||||
$scope.emails = [{name:"",email:""},{name:"",email:""}];
|
||||
$scope.invitees = [{uuid:""},{uuid:""}];
|
||||
$scope.invitees = {uuid:""};
|
||||
|
||||
$scope.inviteNewUsers = function(inviteMethod){
|
||||
if (!$scope.group) {
|
||||
Groups.group.create($scope.newGroup, function() {
|
||||
inviteByMethod(inviteMethod);
|
||||
});
|
||||
} else {
|
||||
inviteByMethod(inviteMethod);
|
||||
}
|
||||
};
|
||||
|
||||
var inviteByMethod = function(inviteMethod) {
|
||||
if (inviteMethod === 'email') {
|
||||
inviteEmails();
|
||||
}
|
||||
else if (inviteMethod === 'uuid') {
|
||||
invite();
|
||||
}
|
||||
else {
|
||||
return console.log('Invalid invite method.')
|
||||
}
|
||||
};
|
||||
|
||||
$scope.inviteEmails = function(){
|
||||
Groups.Group.invite({gid: $scope.group._id}, {inviter: $scope.inviter, emails: $scope.emails}, function(){
|
||||
@@ -151,12 +173,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
|
||||
};
|
||||
|
||||
$scope.invite = function(){
|
||||
var uuidList = _.pluck($scope.invitees,'uuid');
|
||||
Groups.Group.invite({gid: $scope.group._id}, {uuids: uuidList}, function(){
|
||||
Groups.Group.invite({gid: $scope.group._id}, {uuids: [$scope.invitees.uuid]}, function(){
|
||||
Notification.text(window.env.t('invitationsSent'));
|
||||
$scope.invitees = [{uuid:""},{uuid:""}];
|
||||
$scope.invitees = {uuid:""};
|
||||
}, function(){
|
||||
$scope.invitees = [{uuid:""},{uuid:""}];
|
||||
$scope.invitees = {uuid:""};
|
||||
});
|
||||
};
|
||||
}])
|
||||
|
||||
@@ -6,7 +6,7 @@ script(type='text/ng-template', id='modals/invite-friends.html')
|
||||
tabset
|
||||
tab(heading=env.t('inviteByEmail'))
|
||||
p.alert.alert-info=env.t('inviteByEmailExplanation')
|
||||
form.form-horizontal(ng-submit='inviteEmails()')
|
||||
form.form-horizontal(ng-submit='inviteNewUsers("email")')
|
||||
table.table.table-striped
|
||||
thead
|
||||
tr
|
||||
@@ -31,19 +31,15 @@ script(type='text/ng-template', id='modals/invite-friends.html')
|
||||
button.btn.btn-primary(type='submit')=env.t('sendInvitations')
|
||||
tab(heading=env.t('inviteExistUser'))
|
||||
p.alert.alert-info!=env.t('inviteAlertInfo')
|
||||
form.form-horizontal(ng-submit='invite()')
|
||||
form.form-horizontal(ng-submit='inviteNewUsers("uuid")')
|
||||
table.table.table-striped
|
||||
thead
|
||||
tr
|
||||
th=env.t('userId')
|
||||
tbody
|
||||
tr(ng-repeat='invitee in invitees')
|
||||
td
|
||||
input.form-control(type='text', ng-model='invitee.uuid')
|
||||
tr
|
||||
td(colspan=2)
|
||||
a.btn.btn-xs.pull-right(ng-click='invitees = invitees.concat([{uuid:""}])')
|
||||
i.glyphicon.glyphicon-plus
|
||||
td
|
||||
input.form-control(type='text', ng-model='invitees.uuid')
|
||||
tr
|
||||
td
|
||||
.col-sm-1
|
||||
|
||||
Reference in New Issue
Block a user