Categories admin interface fully implemented

This commit is contained in:
Finn 2018-01-11 16:23:42 +00:00
parent c2a099c3e2
commit 4e74c871a2
14 changed files with 2837 additions and 3 deletions

View file

@ -0,0 +1,30 @@
% layout 'admin';
% title 'Categories';
% content_for javascript => begin
% end
% if ( my $error = flash 'error' ) {
<div class="alert alert-danger" role="alert">
<strong>Error!</strong> <%= $error %>
</div>
% } elsif ( my $success = flash 'success' ) {
<div class="alert alert-success" role="alert">
<strong>Success!</strong> <%= $success %>
</div>
% }
<form action="<%= url_for %>" method="post">
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control" placeholder="Category Name" name="category">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Add</button>
</span>
</div>
</div>
</form>
<div class="list-group">
% for my $category (@$categories) {
<a href="<%= url_for . '/' . $category->{id} %>" class="list-group-item list-group-item-action d-flex">
<span><%= $category->{name} %></span>
</a>
% }
</div>

View file

@ -0,0 +1,27 @@
% layout 'admin';
% title 'Categories';
% content_for javascript => begin
% end
% if ( my $error = flash 'error' ) {
<div class="alert alert-danger" role="alert">
<strong>Error!</strong> <%= $error %>
</div>
% } elsif ( my $success = flash 'success' ) {
<div class="alert alert-success" role="alert">
<strong>Success!</strong> <%= $success %>
</div>
% }
<form action="<%= url_for %>" method="post">
<div class="form-group">
<label for="category-name">Token Name</label>
<input id="category-name" type="text" class="form-control" placeholder="Token Text" name="category" value="<%= $category->name %>">
</div>
<div class="form-group">
<button class="btn btn-primary form-control" type="submit">Update</button>
</div>
</form>
<form action="<%= url_for . '/delete' %>" method="post">
<div class="form-group">
<button class="btn btn-danger form-control" type="submit">Delete</button>
</div>
</form>

View file

@ -41,8 +41,14 @@
<li class="nav-item">
<a class="nav-link<%= title eq 'Tokens' ? ' active' : '' %>" href="<%= url_for '/admin/tokens' %>">Tokens</a>
</li>
<li class="nav-item">
<a class="nav-link<%= title eq 'Transactions' ? ' active' : '' %>" href="<%= url_for '/admin/transactions' %>">Transactions</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">
Transactions
</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="<%= url_for '/admin/transactions' %>">Transaction List</a>
<a class="dropdown-item" href="<%= url_for '/admin/categories' %>">Categories</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link<%= title eq 'Users' ? ' active' : '' %>" href="<%= url_for '/admin/users' %>">Users</a>