Re-arrange the admin page so we can have several sub-pages

The first and only one for now being the room management
master
Daniel Berteaud 10 years ago
parent 71867c0f0d
commit eff9565144
  1. 2
      lib/Vroom/I18N/en.pm
  2. 2
      lib/Vroom/I18N/fr.pm
  3. 4
      public/js/vroom.js
  4. 55
      templates/default/admin.html.ep
  5. 55
      templates/default/admin_manage_rooms.html.ep
  6. 40
      vroom.pl

@ -144,7 +144,7 @@ our %Lexicon = (
"AUTH_IF_OWNER" => "Authenticate if you are the room owner", "AUTH_IF_OWNER" => "Authenticate if you are the room owner",
"CREATE_THIS_ROOM" => "Create this room", "CREATE_THIS_ROOM" => "Create this room",
"ADMINISTRATION" => "Administration", "ADMINISTRATION" => "Administration",
"EXISTING_ROOMS" => "Existing rooms", "ROOM_MANAGEMENT" => "Room management",
"MANAGE" => "Manage", "MANAGE" => "Manage",
"ROOM_DETAILS" => "Room details", "ROOM_DETAILS" => "Room details",
"ROOM_ID" => "ID", "ROOM_ID" => "ID",

@ -150,7 +150,7 @@ our %Lexicon = (
"AUTH_IF_OWNER" => "Authentifiez-vous si vous êtes le propriétaire du salon", "AUTH_IF_OWNER" => "Authentifiez-vous si vous êtes le propriétaire du salon",
"CREATE_THIS_ROOM" => "Créez ce salon", "CREATE_THIS_ROOM" => "Créez ce salon",
"ADMINISTRATION" => "Administration", "ADMINISTRATION" => "Administration",
"EXISTING_ROOMS" => "Salons existants", "ROOM_MANAGEMENT" => "Gestion des salons",
"MANAGE" => "Gérer", "MANAGE" => "Gérer",
"ROOM_DETAILS" => "Détails du salon", "ROOM_DETAILS" => "Détails du salon",
"ROOM_ID" => "Identifiant", "ROOM_ID" => "Identifiant",

@ -400,8 +400,8 @@ function initIndex(){
}); });
} }
// Used on the admin page // Used on the room admin page
function initAdmin(){ function initAdminRooms(){
var roomList = {}; var roomList = {};
var matches = 0; var matches = 0;

@ -1,55 +1,12 @@
% title $self->l('ADMINISTRATION'); % title l('ADMINISTRATION');
%= include 'header' %= include 'header'
%= include 'public_toolbar' %= include 'public_toolbar'
<div class="container-fluid">
%= include 'noscript' <div class="col-sm-offset-3 col-md-offset-4 col-sm-6 col-md-4">
%= include 'configure_modal' <a class="btn btn-primary btn-block" href="<%= $self->get_url('/admin/rooms') %>">
%= include 'delete_room_modal' <%=l 'ROOM_MANAGEMENT' %>
<div class="panel panel-default"> </a>
<div class="panel-heading">
<div class="form-inline">
<div class="form-group">
<div class="input-group">
<input type="text" id="searchRoom" class="form-control" value=""/>
<div class="input-group-addon">
<span class="glyphicon glyphicon-search">
</span>
</div>
</div>
</div>
</div>
</div>
<div class="panel-body">
<div class="text-center" id="pagination">
</div>
<table class="table table-hover">
<thead>
<tr>
<th>
<%=l 'ROOM_NAME' %>
</th>
<th class="hidden-xs">
<%=l 'CREATION_DATE' %>
</th>
<th class="hidden-xs">
<%=l 'LAST_ACTIVITY' %>
</th>
<th>
<%=l 'MANAGE' %>
</th>
</tr>
</thead>
<tbody id="roomList">
</tbody>
</table>
</div>
</div>
</div> </div>
%= include 'js_common' %= include 'js_common'
<script>
$(document).ready(function(){
initAdmin();
});
</script>
%= include 'footer' %= include 'footer'

@ -0,0 +1,55 @@
% title $self->l('ROOM_MANAGEMENT');
%=include 'header'
%=include 'public_toolbar'
<div class="container-fluid">
%= include 'noscript'
%= include 'configure_modal'
%= include 'delete_room_modal'
<div class="panel panel-default">
<div class="panel-heading">
<div class="form-inline">
<div class="form-group">
<div class="input-group">
<input type="text" id="searchRoom" class="form-control" value=""/>
<div class="input-group-addon">
<span class="glyphicon glyphicon-search">
</span>
</div>
</div>
</div>
</div>
</div>
<div class="panel-body">
<div class="text-center" id="pagination">
</div>
<table class="table table-hover">
<thead>
<tr>
<th>
<%=l 'ROOM_NAME' %>
</th>
<th class="hidden-xs">
<%=l 'CREATION_DATE' %>
</th>
<th class="hidden-xs">
<%=l 'LAST_ACTIVITY' %>
</th>
<th>
<%=l 'MANAGE' %>
</th>
</tr>
</thead>
<tbody id="roomList">
</tbody>
</table>
</div>
</div>
</div>
%=include 'js_common'
<script>
$(document).ready(function(){
initAdminRooms();
});
</script>
%=include 'footer'

@ -1038,19 +1038,6 @@ get '/about' => sub {
# Route for the help page # Route for the help page
get '/help' => 'help'; get '/help' => 'help';
# Route for the admin pages
get '/admin' => sub {
my $self = shift;
# Someone accessing /admin is considered an admin
# For now, the auth is handled outside of VROOM itself
$self->login;
$self->make_key_admin($self->session('key'));
$self->purge_rooms;
return $self->render('admin',
admin => 1
);
};
# Routes for feedback. One get to display the form # Routes for feedback. One get to display the form
# and one post to get data from it # and one post to get data from it
get '/feedback' => 'feedback'; get '/feedback' => 'feedback';
@ -1836,6 +1823,33 @@ any '/api' => sub {
} }
}; };
group {
under '/admin' => sub {
my $self = shift;
# For now, lets just pretend that anyone able to access
# /admin is already logged in (auth is managed outside of VROOM)
# TODO: support several auth method, including an internal one where user are managed
# in our DB, and another where auth is handled by the web server
$self->login;
$self->make_key_admin($self->session('key'));
$self->purge_rooms;
$self->stash(admin => 1);
return 1;
};
# Admin index
get '/' => sub {
my $self = shift;
return $self->render('admin');
};
# Room management
get '/rooms' => sub {
my $self = shift;
return $self->render('admin_manage_rooms');
};
};
# Catch all route: if nothing else match, it's the name of a room # Catch all route: if nothing else match, it's the name of a room
get '/:room' => sub { get '/:room' => sub {
my $self = shift; my $self = shift;

Loading…
Cancel
Save