Merge pull request #3 from alpha6/navbar

Navbar was added
This commit is contained in:
Denis Fedoseev 2017-08-01 15:56:02 +03:00 committed by GitHub
commit c9a3f580e0
4 changed files with 36 additions and 11 deletions

View file

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

View file

@ -1,17 +1,9 @@
% layout 'base'; % layout 'base';
<h1>Rough, Slow, Stupid, Contrary Photohosting</h1>
<% if (is_user_authenticated()) { %> <% if (is_user_authenticated()) { %>
%= include 'includes/images_list' %= include 'includes/images_list'
<% } else { %> <% } else { %>
<h1>Please login to access your images</h1>
<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>
<% } %> <% } %>

View file

@ -24,7 +24,37 @@
</style> </style>
</head> </head>
<body> <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> </body>
</html> </html>

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

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