mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +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.inviter = User.user.profile.name;
|
||||||
$scope.emails = [{name:"",email:""},{name:"",email:""}];
|
$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(){
|
$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(){
|
||||||
@@ -151,12 +173,11 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.invite = function(){
|
$scope.invite = function(){
|
||||||
var uuidList = _.pluck($scope.invitees,'uuid');
|
Groups.Group.invite({gid: $scope.group._id}, {uuids: [$scope.invitees.uuid]}, function(){
|
||||||
Groups.Group.invite({gid: $scope.group._id}, {uuids: uuidList}, function(){
|
|
||||||
Notification.text(window.env.t('invitationsSent'));
|
Notification.text(window.env.t('invitationsSent'));
|
||||||
$scope.invitees = [{uuid:""},{uuid:""}];
|
$scope.invitees = {uuid:""};
|
||||||
}, function(){
|
}, function(){
|
||||||
$scope.invitees = [{uuid:""},{uuid:""}];
|
$scope.invitees = {uuid:""};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ script(type='text/ng-template', id='modals/invite-friends.html')
|
|||||||
tabset
|
tabset
|
||||||
tab(heading=env.t('inviteByEmail'))
|
tab(heading=env.t('inviteByEmail'))
|
||||||
p.alert.alert-info=env.t('inviteByEmailExplanation')
|
p.alert.alert-info=env.t('inviteByEmailExplanation')
|
||||||
form.form-horizontal(ng-submit='inviteEmails()')
|
form.form-horizontal(ng-submit='inviteNewUsers("email")')
|
||||||
table.table.table-striped
|
table.table.table-striped
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
@@ -31,19 +31,15 @@ script(type='text/ng-template', id='modals/invite-friends.html')
|
|||||||
button.btn.btn-primary(type='submit')=env.t('sendInvitations')
|
button.btn.btn-primary(type='submit')=env.t('sendInvitations')
|
||||||
tab(heading=env.t('inviteExistUser'))
|
tab(heading=env.t('inviteExistUser'))
|
||||||
p.alert.alert-info!=env.t('inviteAlertInfo')
|
p.alert.alert-info!=env.t('inviteAlertInfo')
|
||||||
form.form-horizontal(ng-submit='invite()')
|
form.form-horizontal(ng-submit='inviteNewUsers("uuid")')
|
||||||
table.table.table-striped
|
table.table.table-striped
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th=env.t('userId')
|
th=env.t('userId')
|
||||||
tbody
|
tbody
|
||||||
tr(ng-repeat='invitee in invitees')
|
|
||||||
td
|
|
||||||
input.form-control(type='text', ng-model='invitee.uuid')
|
|
||||||
tr
|
tr
|
||||||
td(colspan=2)
|
td
|
||||||
a.btn.btn-xs.pull-right(ng-click='invitees = invitees.concat([{uuid:""}])')
|
input.form-control(type='text', ng-model='invitees.uuid')
|
||||||
i.glyphicon.glyphicon-plus
|
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
.col-sm-1
|
.col-sm-1
|
||||||
|
|||||||
Reference in New Issue
Block a user