Navbar was added #3

Merged
alpha6 merged 1 commit from navbar into master 2017-08-01 15:56:03 +03:00
4 changed files with 36 additions and 11 deletions

View file

@ -78,7 +78,7 @@ get '/logout' => sub {
my $self = shift;
$self->logout();
$self->render( text => 'bye' );
$self->render( message => 'bye' );
};
get '/register' => ( authenticated => 0 ) => sub {

View file

@ -1,17 +1,9 @@
% layout 'base';
<h1>Rough, Slow, Stupid, Contrary Photohosting</h1>
<% if (is_user_authenticated()) { %>
%= include 'includes/images_list'
<% } else { %>
<div class="login-form">
<form method="post" action="<%= url_for('login') %>" >
<input type="text" name="username" >
<input type="password" name="password">
<input type="submit" value="Login">
</form>
</div>
<h1>Please login to access your images</h1>
<% } %>

View file

@ -24,7 +24,37 @@
</style>
</head>
<body>
<%= content %>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Rough, Slow, Stupid, Contrary Photohosting</a>
</div>
<div class="navbar-collapse collapse">
<% if (!is_user_authenticated()) { %>
<form class="navbar-form navbar-right" role="form" method="post" action="<%= url_for('login') %>">
<div class="form-group">
<input type="text" name="username" placeholder="Username" class="form-control">
</div>
<div class="form-group">
<input name="password" type="password" placeholder="Password" class="form-control">
</div>
<button type="submit" class="btn btn-success">Sign in</button>
</form>
<% } else { %>
<div class="navbar-form navbar-right"><a type="button" class="btn btn-default" href="/logout">Logout</a></div>
<% } %>
</div><!--/.navbar-collapse -->
</div>
</div>
<div class="container">
<%= content %>
</div>
</body>
</html>

3
templates/logout.html.ep Normal file
View file

@ -0,0 +1,3 @@
% layout 'base';
<%= $message %>