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. 63
      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",
"CREATE_THIS_ROOM" => "Create this room",
"ADMINISTRATION" => "Administration",
"EXISTING_ROOMS" => "Existing rooms",
"ROOM_MANAGEMENT" => "Room management",
"MANAGE" => "Manage",
"ROOM_DETAILS" => "Room details",
"ROOM_ID" => "ID",

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

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

@ -1,55 +1,12 @@
% title $self->l('ADMINISTRATION');
%=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>
% title l('ADMINISTRATION');
%= include 'header'
%= include 'public_toolbar'
<div class="col-sm-offset-3 col-md-offset-4 col-sm-6 col-md-4">
<a class="btn btn-primary btn-block" href="<%= $self->get_url('/admin/rooms') %>">
<%=l 'ROOM_MANAGEMENT' %>
</a>
</div>
%=include 'js_common'
<script>
$(document).ready(function(){
initAdmin();
});
</script>
%=include 'footer'
%= include 'js_common'
%= 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
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
# and one post to get data from it
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
get '/:room' => sub {
my $self = shift;

Loading…
Cancel
Save