1
0
mirror of https://github.com/dani/vroom.git synced 2024-06-28 01:39:29 +02:00

Implement room removal in the admin area

This commit is contained in:
Daniel Berteaud 2015-01-29 21:59:30 +01:00
parent e14b8e479c
commit 7c80ca3358
5 changed files with 66 additions and 4 deletions

View File

@ -158,7 +158,7 @@ our %Lexicon = (
"ROOM_NOW_PERSISTENT" => "This room is now persistent",
"ROOM_NO_MORE_PERSISTENT" => "This rooms isn't persistent anymore",
"EMAIL_INVITE" => "Email invitation",
"DELETE_THIS_ROOM" => "Delete this room",
"DELETE" => "Delete",
"CONFIRM_DELETE" => "Confirm delation",
"HELP_SET_DISPLAY_NAME" => "This field lets you type your name which will be displayed for other participants. " .
"It must be set before you can use the chat. no need to validate anything, the name " .

View File

@ -164,7 +164,7 @@ our %Lexicon = (
"ROOM_NOW_PERSISTENT" => "Ce salon est maintenant persistant",
"ROOM_NO_MORE_PERSISTENT" => "Ce salon n'est plus persistant",
"EMAIL_INVITE" => "Invitation par email",
"DELETE_THIS_ROOM" => "Supprimer ce salon",
"DELETE" => "Supprimer",
"CONFIRM_DELETE" => "Confirmer la suppression",
"HELP_SET_DISPLAY_NAME" => "Ce champs vous permet de saisir le nom qui sera affiché pour les autres personnes. " .
"Il est obligatoire avant de pouvoir utiliser le tchat. Pas besoin de valider quoi " .

View File

@ -384,7 +384,7 @@ function initAdmin(){
// Update display of room list
function updateRoomList(filter, min, max){
$('#deviceList').html('');
$('#roomList').html('');
var filterRe = new RegExp(filter, "gi");
var i = 0;
matches = 0;
@ -486,8 +486,36 @@ function initAdmin(){
getRoomConf(roomName);
});
$(document).on('click', '.btn-remove', function(){
roomName = $(this).data('room');
$('#deleteRoomModal').modal('show');
});
// Get room list right after loading the page
getRooms();
// Delete room form
$('#deleteRoomForm').submit(function(e){
e.preventDefault();
$.ajax({
data: {
req: JSON.stringify({
action: 'delete_room',
param: {
room: roomName,
}
})
},
error: function(data){
$.notify(locale.ERROR_OCCURRED, 'error');
},
success: function(data){
$.notify(data.msg, 'success');
getRooms();
$('#deleteRoomModal').modal('hide');
}
});
});
}
// This is the main function called when you join a room

View File

@ -4,7 +4,7 @@
<div class="container-fluid">
%= include 'noscript'
%= include 'configure_modal'
%= include 'invite_modal'
%= include 'delete_room_modal'
<div class="panel panel-default">
<div class="panel-heading">
<div class="form-inline">

View File

@ -0,0 +1,34 @@
<div class="modal fade" role="dialog" id="deleteRoomModal" aria-labelledby="deleteRoomModal" aria-hidden="true">
<div class="modal-dialog">
<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 'CONFIRM_DELETE' %>
</h4>
</div>
<div class="modal-body">
<p>
<%=l 'ROOM_WILL_BE_DELETED' %>
</p>
</div>
<div class="modal-footer">
<form id="deleteRoomForm" class="form-horizontal" role="form">
<div class="form-group">
<div class="col-sm-offset-4 col-sm-8">
<button type="submit" class="btn btn-danger">
<%=l 'DELETE' %>
</button>
<button class="btn btn-default" data-dismiss="modal">
<%=l 'CANCEL' %>
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>