Add email invitation suport on the management page

master
Daniel Berteaud 11 years ago
parent 7d02133483
commit f75fb45941
  1. 1
      lib/Vroom/I18N/en.pm
  2. 1
      lib/Vroom/I18N/fr.pm
  3. 23
      public/js/vroom.js
  4. 45
      templates/default/invite_modal.html.ep
  5. 45
      templates/default/join.html.ep
  6. 12
      templates/default/manage_room.html.ep

@ -169,6 +169,7 @@ our %Lexicon = (
"ASK_FOR_NAME" => "Require to enter a name",
"PASSWORD_PROTECTED" => "Password protection",
"PERSISTENT" => "Persistent",
"EMAIL_INVITE" => "Email invitation",
"DELETE_THIS_ROOM" => "Delete this room",
"CONFIRM_DELETE" => "Confirm delation",
"HELP_SET_DISPLAY_NAME" => "This field lets you type your name which will be displayed for other participants. " .

@ -176,6 +176,7 @@ our %Lexicon = (
"ASK_FOR_NAME" => "Exige de saisir un nom",
"PASSWORD_PROTECTED" => "Protection par mot de passe",
"PERSISTENT" => "Persistant",
"EMAIL_INVITE" => "Invitation par email",
"DELETE_THIS_ROOM" => "Supprimer ce salon",
"CONFIRM_DELETE" => "Confirmer la suppression",
"HELP_SET_DISPLAY_NAME" => "Ce champs vous permet de saisir le nom qui sera affiché pour les autres personnes. " .

@ -472,6 +472,29 @@ function initManage(){
}, 2000);
});
// Show the invite by email dialog
$('#showEmailInvite').click(function(){
$('#emailInviteModal').modal('show');
data.room = $(this).data('room');
});
// Handle Email Invitation
$('#inviteEmail').submit(function(event) {
event.preventDefault();
var rcpt = $('#recipient').val();
message = $('#message').val();
// Simple email address verification
// not fullproof, but email validation is a real nightmare
if (!rcpt.match(/\S+@\S+\.\S+/)){
$.notify(locale.ERROR_MAIL_INVALID, 'error');
return;
}
data.action = 'invite';
data.recipient = rcpt;
data.message = message
sendAction(data);
});
}
// This is the main function called when you join a room

@ -0,0 +1,45 @@
<div class="modal fade" role="dialog" id="emailInviteModal" aria-labelledby="emailInviteModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
&times;
</button>
<h4 class="modal-title">
<%=l 'SEND_INVITE' %>
</h4>
</div>
<div class="modal-body">
<form id ="inviteEmail" class="form-horizontal" role="form">
<div class="form-group">
<label for="recipient" class="col-sm-4 control-label">
<%=l 'RECIPIENT' %>
</label>
<div class="col-sm-8">
<input type="email" id="recipient" class="form-control" placeholder="<%=l 'EMAIL_PLACEHOLDER' %>"/>
</div>
</div>
<div class="form-group">
<label for="recipient" class="col-sm-4 control-label">
<%=l 'MESSAGE' %>
</label>
<div class="col-sm-8">
<textarea id="message" name="message" class="form-control" placeholder="<%=l 'MESSAGE' %>"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" id="inviteEmailButton" class="btn btn-primary">
<%=l 'SUBMIT' %>
</button>
<button class="btn btn-default" data-dismiss="modal">
<%=l 'CANCEL' %>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>

@ -802,50 +802,7 @@
</div>
</div>
</div>
<div class="modal fade" role="dialog" id="emailInviteModal" aria-labelledby="persistentModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
&times;
</button>
<h4 class="modal-title">
<%=l 'SEND_INVITE' %>
</h4>
</div>
<div class="modal-body">
<form id ="inviteEmail" class="form-horizontal" role="form" id="persistentForm">
<div class="form-group">
<label for="recipient" class="col-sm-4 control-label">
<%=l 'RECIPIENT' %>
</label>
<div class="col-sm-8">
<input type="email" id="recipient" class="form-control" placeholder="<%=l 'EMAIL_PLACEHOLDER' %>"/>
</div>
</div>
<div class="form-group">
<label for="recipient" class="col-sm-4 control-label">
<%=l 'MESSAGE' %>
</label>
<div class="col-sm-8">
<textarea id="message" name="message" class="form-control" placeholder="<%=l 'MESSAGE' %>"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" id="inviteEmailButton" class="btn btn-primary">
<%=l 'SUBMIT' %>
</button>
<button class="btn btn-default" data-dismiss="modal">
<%=l 'CANCEL' %>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
%=include 'invite_modal'
%=include 'owner_password_modal'
%=include 'join_password_modal'
%=include 'noscript'

@ -4,6 +4,7 @@
<div class="container-fluid">
%= include 'owner_password_modal'
%= include 'join_password_modal'
%= include 'invite_modal'
<div class="modal fade" role="dialog" id="deleteRoomModal" aria-labelledby="terminateModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
@ -103,6 +104,17 @@
<input class="bs-switch" type="checkbox" id="ownerPassSwitch" data-room="<%= $room %>" <%= ($data->{owner_password}) ? 'checked':''%>>
</th>
</tr>
<tr>
<th>
<%=l 'EMAIL_INVITE' %>
</th>
<th>
<button type="button" class="btn btn-default help" id="showEmailInvite" data-room="<%= $room %>" data-toggle="tooltip" data-placement="bottom" title="<%=l 'YOU_CAN_INVITE_BY_MAIL' %>">
<span class="glyphicon glyphicon-envelope">
</span>
</button>
</th>
</tr>
</tbody>
</table>
</div>

Loading…
Cancel
Save