3
0

sidebar séparée du reste des pages

This commit is contained in:
Philippe Pittoli 2014-01-23 00:25:33 +01:00
parent f7661b1449
commit a858943338
7 changed files with 48 additions and 108 deletions

View File

@ -46,8 +46,7 @@ get '/' => sub {
if( $success ) { if( $success ) {
template index => { template index => {
logged => true login => session('login')
, login => session('login')
, admin => session('admin') , admin => session('admin')
, domains => [ @domains ] }; , domains => [ @domains ] };
} }
@ -222,7 +221,6 @@ any ['get', 'post'] => '/admin' => sub {
unless ( $auth_ok && $isadmin ) { unless ( $auth_ok && $isadmin ) {
redirect '/ '; redirect '/ ';
return;
} }
else { else {

View File

@ -1,25 +1,4 @@
<div id="sidebar"> <% include sidebar.tt %>
Welcome <% login %> !
<a href="/user/logout">Déconnexion</a>
<br />
<a href="/home">Ma page</a>
<br />
<a href='/admin'>Page d'administration</a>
<br />
<a href='/'>Accueil</a>
<br />
<% IF domains %>
Liens rapides :<br />
<% FOREACH domain IN domains %>
<a href="/domain/details/<% domain %>"><% domain %></a><br />
<% END %>
<% END %>
</div>
<div id="page"> <div id="page">
<h1>Bienvenue sur la page d'administration</h1> <h1>Bienvenue sur la page d'administration</h1>

View File

@ -1,21 +1,4 @@
<div id="sidebar"> <% include sidebar.tt %>
Welcome <% login %> !
<br />
<a href="/user/logout">Déconnexion</a>
<br />
<a href="/home">Ma page</a>
<br />
<% IF admin == 1 %>
<a href='/admin'>Page d'administration</a>
<br />
<% END %>
<a href='/'>Accueil</a>
</div>
<div id="page"> <div id="page">

View File

@ -1,18 +1,4 @@
<div id="sidebar"> <% include sidebar.tt %>
Welcome <% login %> !
<br />
<a href="/user/logout">Déconnexion</a>
<br />
<% IF admin == 1 %>
<a href='/admin'>Page d'administration</a>
<br />
<% END %>
<a href='/'>Accueil</a>
</div>
<div id="page"> <div id="page">

View File

@ -1,38 +1,4 @@
<div id="sidebar"> <% include sidebar.tt %>
<% IF logged == 1 %>
Welcome <% login %> !
<br />
<a href="/user/logout">Déconnexion</a>
<br />
<a href='/home'>Ma page</a><br />
<% IF admin == 1 %>
<a href='/admin'>Page d'administration</a>
<br />
<% END %>
<% IF domains %>
Liens rapides :<br />
<% FOREACH domain IN domains %>
<a href="/domain/details/<% domain %>"><% domain %></a><br />
<% END %>
<% END %>
<% ELSE %>
<form action="/user/login" method="post" accept-charset="utf-8">
<label for="login">Votre login : </label>
<input type="text" name="login" value="" />
<label for="password">Votre mot de passe : </label>
<input type="password" name="password" value="" />
<p><input type="submit" value="Connexion &rarr;" /></p>
</form>
<% END %>
</div>
<div id="page"> <div id="page">

42
www/views/sidebar.tt Normal file
View File

@ -0,0 +1,42 @@
<div id="sidebar">
<% IF login.defined %>
Salut <% login %> !
<br />
<a href="/user/logout">Déconnexion</a>
<br />
<a href='/home'>Ma page</a><br />
<br />
<% IF admin == 1 %>
<a href='/admin'>Page d'administration</a>
<br />
<% END %>
<% IF domains %>
Liens rapides :<br />
<% FOREACH domain IN domains %>
<a href="/domain/details/<% domain %>"><% domain %></a><br />
<% END %>
<% END %>
<% ELSE %>
Se connecter : <br />
<form action="/user/login" method="post" accept-charset="utf-8">
<label for="login">Votre login : </label>
<input type="text" name="login" value="" />
<label for="password">Votre mot de passe : </label>
<input type="password" name="password" value="" />
<p><input type="submit" value="Connexion &rarr;" /></p>
</form>
<% END %>
<br />
<a href='/'>Accueil</a>
<br />
</div>

View File

@ -1,18 +1,4 @@
<div id="sidebar"> <% include sidebar.tt %>
Welcome <% login %> !
<br />
<a href="/user/logout">Déconnexion</a>
<br />
<% IF admin == 1 %>
<a href='/admin'>Page d'administration</a>
<br />
<% END %>
<a href='/'>Accueil</a>
</div>
<div id="page"> <div id="page">