Standardised delete aesthetics regarding roles and users

Also added user delete success message.
Fixes #114
This commit is contained in:
Dan Brown 2016-05-22 09:23:41 +01:00
parent 49621e7b15
commit 23ab1f0c81
3 changed files with 23 additions and 18 deletions

View File

@ -200,11 +200,14 @@ class UserController extends Controller
});
$user = $this->userRepo->getById($id);
if ($this->userRepo->isOnlyAdmin($user)) {
session()->flash('error', 'You cannot delete the only admin');
return redirect($user->getEditUrl());
}
$this->userRepo->destroy($user);
session()->flash('success', 'User successfully removed');
return redirect('/settings/users');
}

View File

@ -3,9 +3,15 @@
<div class="container">
<div class="row">
<div class="col-md-12 setting-nav nav-tabs">
<a href="/settings" @if($selected == 'settings') class="selected text-button" @endif><i class="zmdi zmdi-settings"></i>Settings</a>
<a href="/settings/users" @if($selected == 'users') class="selected text-button" @endif><i class="zmdi zmdi-accounts"></i>Users</a>
<a href="/settings/roles" @if($selected == 'roles') class="selected text-button" @endif><i class="zmdi zmdi-lock-open"></i>Roles</a>
@if($currentUser->can('settings-manage'))
<a href="/settings" @if($selected == 'settings') class="selected text-button" @endif><i class="zmdi zmdi-settings"></i>Settings</a>
@endif
@if($currentUser->can('users-manage'))
<a href="/settings/users" @if($selected == 'users') class="selected text-button" @endif><i class="zmdi zmdi-accounts"></i>Users</a>
@endif
@if($currentUser->can('user-roles-manage'))
<a href="/settings/roles" @if($selected == 'roles') class="selected text-button" @endif><i class="zmdi zmdi-lock-open"></i>Roles</a>
@endif
</div>
</div>
</div>

View File

@ -3,33 +3,29 @@
@section('content')
<div class="faded-small toolbar">
<div class="container">
<div class="row">
<div class="col-sm-6"></div>
<div class="col-sm-6 faded">
<div class="action-buttons">
<a href="/settings/users/{{$user->id}}/delete" class="text-neg text-button"><i class="zmdi zmdi-delete"></i>Delete User</a>
</div>
</div>
</div>
</div>
</div>
@include('settings/navbar', ['selected' => 'users'])
<div class="container small">
<form action="/settings/users/{{$user->id}}" method="post">
<div class="row">
<div class="row">
<div class="col-sm-8">
<h1>Edit {{ $user->id === $currentUser->id ? 'Profile' : 'User' }}</h1>
</div>
<div class="col-sm-4">
<p></p>
<a href="/settings/users/{{$user->id}}/delete" class="neg button float right">Delete User</a>
</div>
</div>
<div class="row">
<div class="col-md-6" ng-non-bindable>
<h1>Edit {{ $user->id === $currentUser->id ? 'Profile' : 'User' }}</h1>
{!! csrf_field() !!}
<input type="hidden" name="_method" value="put">
@include('users.forms.' . $authMethod, ['model' => $user])
</div>
<div class="col-md-6">
<h1>&nbsp;</h1>
<div class="form-group" id="logo-control">
<label for="user-avatar">User Avatar</label>
<p class="small">This image should be approx 256px square.</p>