Initial work on Admin users page
This commit is contained in:
parent
13d1f8d4a7
commit
1d02854c96
3 changed files with 40 additions and 9 deletions
|
@ -110,7 +110,6 @@ sub startup {
|
|||
$admin_routes->post('/tokens/:id')->to('admin-tokens#update');
|
||||
$admin_routes->post('/tokens/:id/delete')->to('admin-tokens#delete');
|
||||
$admin_routes->get('/users')->to('admin-users#index');
|
||||
$admin_routes->post('/users')->to('admin-users#create');
|
||||
$admin_routes->get('/users/:id')->to('admin-users#read');
|
||||
$admin_routes->post('/users/:id')->to('admin-users#update');
|
||||
$admin_routes->post('/users/:id/delete')->to('admin-users#delete');
|
||||
|
|
|
@ -14,20 +14,22 @@ sub index {
|
|||
$c->stash( users => [ $user_rs->all ] );
|
||||
}
|
||||
|
||||
sub create {
|
||||
my $c = shift;
|
||||
}
|
||||
|
||||
sub read {
|
||||
my $c = shift;
|
||||
|
||||
my $id = $c->param('id');
|
||||
|
||||
if ( my $user = $c->result_set->find($id) ) {
|
||||
$c->stash( user => $user );
|
||||
} else {
|
||||
$c->flash( error => 'No User found' );
|
||||
$c->redirect_to( '/admin/users' );
|
||||
}
|
||||
}
|
||||
|
||||
sub update {
|
||||
my $c = shift;
|
||||
}
|
||||
|
||||
sub delete {
|
||||
my $c = shift;
|
||||
$c->redirect_to( '/admin/users' );
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
30
templates/admin/users/read.html.ep
Normal file
30
templates/admin/users/read.html.ep
Normal file
|
@ -0,0 +1,30 @@
|
|||
% layout 'admin';
|
||||
% title 'Users';
|
||||
% 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="email">Email Address</label>
|
||||
<input id="email" type="text" class="form-control" placeholder="Email" name="email" value="<%= $user->email %>" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="joindate">Join Date</label>
|
||||
<input id="joindate" type="datetime" class="form-control" placeholder="Date" name="joindate" value="<%= $user->joindate %>" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type">Account Type</label>
|
||||
<input id="type" type="text" class="form-control" value="<%= defined $user->customerid_fk ? 'Customer' : 'Organisation' %>" disabled>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary form-control" type="submit">Update</button>
|
||||
</div>
|
||||
</form>
|
Reference in a new issue