1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2025-07-17 01:42:34 +02:00

Simplfied template for navigation

This commit is contained in:
Hubert depesz Lubaczewski
2020-07-14 15:24:44 +02:00
parent 813692cba8
commit 4cb8fba42f
2 changed files with 27 additions and 9 deletions

View File

@ -86,7 +86,12 @@ header .motto {
font-weight: normal;
vertical-align: middle;
}
#currentPage {
background: linear-gradient(#555, #333);
}
#currentPage a {
color: #ff0;
}
footer {
padding: 10px 5px;
background: linear-gradient(#111, #282828);

View File

@ -1,5 +1,18 @@
%# We don't want to allow iframe for whole site
<% $c->res->headers->header( 'X-Frame-Options' => 'deny' ); %>
%# Helper code to avoid tedious repetition for menu items
% my $navLink = begin
% my ( $code, $title ) = @_;
% $title //= $code;
% if ( $code eq current_route ) {
<li id="currentPage">
% } else {
<li>
% }
<a href="<%= url_for $code %>"><%== $title %></a></li>
% end;
<!doctype html>
<html>
<head>
@ -16,21 +29,21 @@
</header>
<nav id="main-nav">
<ul>
<li><a href="#">new explain</a></li>
<li><a href="#">history</a></li>
<li><a href="#">help</a></li>
<li><a href="http://www.depesz.com/index.php/tag/explaindepeszcom/" title="about explain.depesz.com">about</a></li>
<li><a href="<%= url_for 'contact' %>" title="link to: contact">contact</a></li>
%= $navLink->( 'new-explain', 'new explain' );
%= $navLink->( 'history' );
%= $navLink->( 'help' );
<li><a href="http://www.depesz.com/index.php/tag/explaindepeszcom/">about</a></li>
%= $navLink->( 'contact' );
</ul>
<ul>
% if ( 'show' eq current_route ) {
<li><a href="#">settings</a></li>
% }
% if ( session('user') ) {
<li><a href="<%= url_for 'user' %>" title="user page"><span>user:</span> <%= session('user') %></a></li>
<li><a href="<%= url_for 'user-history' %>" title="link to: user plans">plans</a></li>
%= $navLink->( 'login', '<span>user:</span> ' . session('user') );
%= $navLink->( 'user-history', 'plans' );
% } else {
<li><a href="<%=url_for 'login' %>" title="login/register">login</a></li>
%= $navLink->( 'login' );
% }
</ul>
</nav>