Added extra redirects and basic pages for getting between admin and user
side
This commit is contained in:
parent
30c80679be
commit
58ab852f4c
4 changed files with 75 additions and 2 deletions
|
@ -3,6 +3,10 @@ use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
sub index {
|
sub index {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
|
|
||||||
|
if ( $c->is_user_authenticated ) {
|
||||||
|
$c->redirect_to('/home');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub under {
|
sub under {
|
||||||
|
@ -34,7 +38,6 @@ sub auth_logout {
|
||||||
|
|
||||||
sub home {
|
sub home {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
$c->render(text => 'Root Home');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
%= content_for 'css';
|
%= content_for 'css';
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-toggleable-md fixed-top navbar-inverse bg-primary">
|
<nav class="navbar navbar-toggleable-md fixed-top navbar-inverse bg-danger">
|
||||||
<button class="navbar-toggler navbar-toggler-right"
|
<button class="navbar-toggler navbar-toggler-right"
|
||||||
type="button"
|
type="button"
|
||||||
data-toggle="collapse"
|
data-toggle="collapse"
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
<a class="navbar-brand" href="<%= url_for '/admin' %>">LocalLoop Admin</a>
|
<a class="navbar-brand" href="<%= url_for '/admin' %>">LocalLoop Admin</a>
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
<div class="navbar-nav ml-auto">
|
<div class="navbar-nav ml-auto">
|
||||||
|
<a class="nav-item nav-link" href="<%= url_for '/home' %>">User Section</a>
|
||||||
<a class="nav-item nav-link<%= title eq 'Tokens' ? ' active' : '' %>" href="<%= url_for '/admin/tokens' %>">Tokens</a>
|
<a class="nav-item nav-link<%= title eq 'Tokens' ? ' active' : '' %>" href="<%= url_for '/admin/tokens' %>">Tokens</a>
|
||||||
<a class="nav-item nav-link<%= title eq 'Users' ? ' active' : '' %>" href="#">Users</a>
|
<a class="nav-item nav-link<%= title eq 'Users' ? ' active' : '' %>" href="#">Users</a>
|
||||||
<a class="nav-item nav-link" href="<%= url_for '/logout' %>">Logout</a>
|
<a class="nav-item nav-link" href="<%= url_for '/logout' %>">Logout</a>
|
||||||
|
|
44
templates/layouts/user.html.ep
Normal file
44
templates/layouts/user.html.ep
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>LocalLoop - <%= title %></title>
|
||||||
|
|
||||||
|
<!-- Bootstrap and jQuery js -->
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
|
||||||
|
|
||||||
|
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
%= content_for 'css';
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-toggleable-md fixed-top navbar-inverse bg-primary">
|
||||||
|
<button class="navbar-toggler navbar-toggler-right"
|
||||||
|
type="button"
|
||||||
|
data-toggle="collapse"
|
||||||
|
data-target="#navbarNav"
|
||||||
|
aria-controls="navbarNav"
|
||||||
|
aria-expanded="false"
|
||||||
|
aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="navbar-brand" href="<%= url_for '/home' %>">LocalLoop</a>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<div class="navbar-nav ml-auto">
|
||||||
|
% if ( defined $c->current_user->administrator ) {
|
||||||
|
<a class="nav-item nav-link" href="<%= url_for '/admin' %>">Admin Section</a>
|
||||||
|
% }
|
||||||
|
<a class="nav-item nav-link<%= title eq 'Receipts' ? ' active' : '' %>" href="#">Receipts</a>
|
||||||
|
<a class="nav-item nav-link<%= title eq 'Settings' ? ' active' : '' %>" href="#">Settings</a>
|
||||||
|
<a class="nav-item nav-link" href="<%= url_for '/logout' %>">Logout</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<%= content %>
|
||||||
|
%= content_for 'javascript';
|
||||||
|
</body>
|
||||||
|
</html>
|
25
templates/root/home.html.ep
Normal file
25
templates/root/home.html.ep
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
% layout 'user';
|
||||||
|
% title 'Home';
|
||||||
|
% content_for css => begin
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background: whitesmoke;
|
||||||
|
padding-top: 54px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel {
|
||||||
|
background: white;
|
||||||
|
padding: 16px;
|
||||||
|
-webkit-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.2);
|
||||||
|
-moz-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.2);
|
||||||
|
box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.login-form {
|
||||||
|
margin-top: 20%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
% end
|
||||||
|
% content_for javascript => begin
|
||||||
|
% end
|
||||||
|
<div>User Pages</div>
|
Reference in a new issue