Modified admin interfaces, factored common css out

This commit is contained in:
Tom Bloor 2017-04-18 10:43:23 +01:00
parent 208e45082f
commit 36e8cfe1d0
6 changed files with 106 additions and 128 deletions

View file

@ -15,6 +15,16 @@ sub under {
sub home {
my $c = shift;
my $user_rs = $c->schema->resultset('User');
my $token_rs = $c->schema->resultset('AccountToken');
$c->stash(
user_count => $user_rs->count,
tokens => {
total => $token_rs->count,
unused => $token_rs->search({used => 0 })->count,
},
);
}
1;

View file

@ -0,0 +1,10 @@
body {
background: whitesmoke;
padding-top: 70px;
}
.panel {
-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);
}

View file

@ -1,25 +1,26 @@
% layout 'admin';
% 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>Admin Pages</div>
<div class="card-deck">
<div class="card text-center">
<div class="card-header card-inverse card-primary">
User Count
</div>
<div class="card-block">
<h2 class="card-title">
%= $user_count
</h2>
</div>
</div>
<div class="card text-center">
<div class="card-header card-inverse card-success">
Unused Tokens
</div>
<div class="card-block">
<h2 class="card-title">
<%= $tokens->{unused} %> / <%= $tokens->{total} %>
</h2>
</div>
</div>
</div>

View file

@ -1,28 +1,7 @@
% layout 'admin';
% title 'Tokens';
% content_for css => begin
<style>
body {
background: whitesmoke;
padding-top: 70px;
}
.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 class="container">
% if ( my $error = flash 'error' ) {
<div class="alert alert-danger" role="alert">
<strong>Error!</strong> <%= $error %>
@ -54,4 +33,3 @@ body {
</a>
% }
</div>
</div>

View file

@ -1,28 +1,7 @@
% layout 'admin';
% title 'Tokens';
% content_for css => begin
<style>
body {
background: whitesmoke;
padding-top: 70px;
}
.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 class="container">
% if ( my $error = flash 'error' ) {
<div class="alert alert-danger" role="alert">
<strong>Error!</strong> <%= $error %>
@ -53,4 +32,3 @@ body {
<button class="btn btn-danger form-control" type="submit">Delete</button>
</div>
</form>
</div>

View file

@ -11,7 +11,7 @@
<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';
%= stylesheet '/static/admin/css/main.css';
</head>
<body>
<nav class="navbar navbar-toggleable-md fixed-top navbar-inverse bg-danger">
@ -30,13 +30,14 @@
<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 'Users' ? ' active' : '' %>" href="#">Users</a>
<a class="nav-item nav-link<%= title eq 'Users' ? ' active' : '' %>" href="<%= url_for '/admin/users' %>">Users</a>
<a class="nav-item nav-link" href="<%= url_for '/logout' %>">Logout</a>
</div>
</div>
</nav>
<div class="container">
<%= content %>
</div>
%= content_for 'javascript';
</body>
</html>