#1, #3: Added icons to all the "primary" action buttons. Groups now displays the number of members and links between the users and groups screens directly. Added the number of groups to the admin stats widget.

This commit is contained in:
Andy Heathershaw 2017-02-15 09:14:52 +00:00
parent 4e2e66f2f2
commit 29e62715c0
21 changed files with 80 additions and 34 deletions

View File

@ -14,4 +14,9 @@ class Group extends Model
protected $fillable = [ protected $fillable = [
'name' 'name'
]; ];
public function users()
{
return $this->belongsToMany(User::class, 'user_groups');
}
} }

View File

@ -6,6 +6,7 @@ use App\Album;
use App\Configuration; use App\Configuration;
use App\Facade\Theme; use App\Facade\Theme;
use App\Facade\UserConfig; use App\Facade\UserConfig;
use App\Group;
use App\Helpers\ConfigHelper; use App\Helpers\ConfigHelper;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\SaveSettingsRequest; use App\Http\Requests\SaveSettingsRequest;
@ -33,11 +34,13 @@ class DefaultController extends Controller
$albumCount = Album::all()->count(); $albumCount = Album::all()->count();
$photoCount = Photo::all()->count(); $photoCount = Photo::all()->count();
$groupCount = Group::all()->count();
$userCount = User::where('is_activated', true)->count(); $userCount = User::where('is_activated', true)->count();
return Theme::render('admin.index', [ return Theme::render('admin.index', [
'album_count' => $albumCount, 'album_count' => $albumCount,
'app_version' => config('app.version'), 'app_version' => config('app.version'),
'group_count' => $groupCount,
'memory_limit' => ini_get('memory_limit'), 'memory_limit' => ini_get('memory_limit'),
'photo_count' => $photoCount, 'photo_count' => $photoCount,
'php_version' => phpversion(), 'php_version' => phpversion(),

View File

@ -72,6 +72,11 @@ return [
'edit_user_title' => 'Edit user account: :name', 'edit_user_title' => 'Edit user account: :name',
'group_deletion_failed' => 'An error occurred while removing the ":name" group: :error_message', 'group_deletion_failed' => 'An error occurred while removing the ":name" group: :error_message',
'group_deletion_successful' => 'The ":name" group was removed successfully.', 'group_deletion_successful' => 'The ":name" group was removed successfully.',
'group_details_tab' => 'Details',
'group_no_users_message' => 'This group has no users assigned to it. Assign users to this group by using the Groups tab on the Edit User page.',
'group_number_users' => '{0} No users|{1} 1 user|[2,Inf] :count users',
'group_users_message' => 'The users shown below are linked to this group. To remove a user, click the user\'s name and untick the ":group_name" group from the Groups tab.',
'group_users_tab' => 'Users',
'inactive_storage_legend' => 'Inactive storage location that cannot be used for new albums.', 'inactive_storage_legend' => 'Inactive storage location that cannot be used for new albums.',
'is_uploading' => 'Uploading in progress...', 'is_uploading' => 'Uploading in progress...',
'legend' => 'Legend/Key', 'legend' => 'Legend/Key',
@ -127,6 +132,7 @@ return [
'settings_title' => 'Settings', 'settings_title' => 'Settings',
'stats_widget' => [ 'stats_widget' => [
'albums' => 'album|albums', 'albums' => 'album|albums',
'groups' => 'group|groups',
'panel_header' => 'Statistics', 'panel_header' => 'Statistics',
'photos' => 'photo|photos', 'photos' => 'photo|photos',
'users' => 'user|users', 'users' => 'user|users',

View File

@ -54,7 +54,7 @@
<div class="form-actions"> <div class="form-actions">
<a href="{{ route('albums.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('albums.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} <button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -38,7 +38,7 @@
<div class="form-actions"> <div class="form-actions">
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} <button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -180,7 +180,7 @@
<div class="form-actions"> <div class="form-actions">
<a href="{{ route('storage.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('storage.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -88,7 +88,7 @@
<div class="form-actions"> <div class="form-actions">
<a href="{{ route('users.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('users.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.create_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -21,13 +21,13 @@
<div class="col-xs-12"> <div class="col-xs-12">
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<p>@lang('admin.delete_album_confirm', ['name' => $album->name])</p> <p>@lang('admin.delete_album_confirm', ['name' => $album->name])</p>
<div class="alert alert-warning"> <div class="alert alert-danger">
@lang('admin.delete_album_warning') @lang('admin.delete_album_warning')
</div> </div>
<div class="form-actions"> <div class="form-actions">
{!! Form::open(['route' => ['albums.destroy', $album->id], 'method' => 'DELETE']) !!} {!! Form::open(['route' => ['albums.destroy', $album->id], 'method' => 'DELETE']) !!}
<a href="{{ route('albums.show', ['id' => $album->id]) }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('albums.show', ['id' => $album->id]) }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} <button type="submit" class="btn btn-danger"><i class="fa fa-fw fa-trash"></i> @lang('forms.delete_action')</button>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>

View File

@ -26,7 +26,7 @@
<div class="form-actions"> <div class="form-actions">
{!! Form::open(['route' => ['groups.destroy', $group->id], 'method' => 'DELETE']) !!} {!! Form::open(['route' => ['groups.destroy', $group->id], 'method' => 'DELETE']) !!}
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} <button type="submit" class="btn btn-danger"><i class="fa fa-fw fa-trash"></i> @lang('forms.delete_action')</button>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>

View File

@ -20,13 +20,13 @@
<div class="col-xs-12"> <div class="col-xs-12">
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<p>@lang('admin.delete_storage_confirm', ['name' => $storage->name])</p> <p>@lang('admin.delete_storage_confirm', ['name' => $storage->name])</p>
<div class="alert alert-warning"> <div class="alert alert-danger">
@lang('admin.delete_storage_warning') @lang('admin.delete_storage_warning')
</div> </div>
<div class="form-actions"> <div class="form-actions">
{!! Form::open(['route' => ['storage.destroy', $storage->id], 'method' => 'DELETE']) !!} {!! Form::open(['route' => ['storage.destroy', $storage->id], 'method' => 'DELETE']) !!}
<a href="{{ route('storage.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('storage.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} <button type="submit" class="btn btn-danger"><i class="fa fa-fw fa-trash"></i> @lang('forms.delete_action')</button>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>

View File

@ -26,7 +26,7 @@
<div class="form-actions"> <div class="form-actions">
{!! Form::open(['route' => ['users.destroy', $user->id], 'method' => 'DELETE']) !!} {!! Form::open(['route' => ['users.destroy', $user->id], 'method' => 'DELETE']) !!}
<a href="{{ route('users.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('users.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} <button type="submit" class="btn btn-danger"><i class="fa fa-fw fa-trash"></i> @lang('forms.delete_action')</button>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
</div> </div>

View File

@ -43,7 +43,7 @@
<div class="form-actions"> <div class="form-actions">
<a href="{{ route('albums.show', ['id' => $album->id]) }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('albums.show', ['id' => $album->id]) }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -23,22 +23,51 @@
<hr/> <hr/>
{!! Form::model($group, ['route' => ['groups.update', $group->id], 'method' => 'PUT']) !!} {!! Form::model($group, ['route' => ['groups.update', $group->id], 'method' => 'PUT']) !!}
<div class="row"> <div>
<div class="col-md-6 col-md-offset-3"> {{-- Nav tabs --}}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}"> <ul class="nav nav-tabs" role="tablist">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!} <li role="presentation" class="active"><a href="#details-tab" aria-controls="details-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-info-circle"></i> @lang('admin.group_details_tab')</a></li>
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!} <li role="presentation"><a href="#users-tab" aria-controls="groups-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-users"></i> @lang('admin.group_users_tab')</a></li>
</ul>
@if ($errors->has('name')) {{-- Tab panes --}}
<span class="help-block"> <div class="tab-content">
<strong>{{ $errors->first('name') }}</strong> {{-- Details --}}
</span> <div role="tabpanel" class="tab-pane active" id="details-tab">
@endif <div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
{!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!}
{!! Form::text('name', old('name'), ['class' => 'form-control']) !!}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
@endif
</div>
<div class="form-actions">
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
<button class="btn btn-success" type="submit"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button>
</div>
</div>
</div>
</div> </div>
<div class="form-actions"> {{-- Users --}}
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <div role="tabpanel" class="tab-pane" id="users-tab">
{!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} @if ($group->users()->count() > 0)
<p>@lang('admin.group_users_message', ['group_name' => $group->name])</p>
<ul class="nav nav-pills">
@foreach ($group->users as $user)
<li><a href="{{ route('users.edit', [$user->id]) }}">{{ $user->name }}</a></li>
@endforeach
</ul>
@else
<p class="text-danger">@lang('admin.group_no_users_message')</p>
<p><a class="btn btn-default" href="{{ route('users.index') }}">@lang('admin.users_title')</a></p>
@endif
</div> </div>
</div> </div>
</div> </div>

View File

@ -65,7 +65,7 @@
<div class="form-actions"> <div class="form-actions">
<a href="{{ route('storage.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('storage.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>

View File

@ -127,7 +127,7 @@
<div class="form-actions" style="margin-top: 20px;"> <div class="form-actions" style="margin-top: 20px;">
<a href="{{ route('users.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('users.index') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('forms.save_action')</button>
</div> </div>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}

View File

@ -27,7 +27,7 @@
<h4 class="text-danger"><b>@lang('admin.no_albums_title')</b></h4> <h4 class="text-danger"><b>@lang('admin.no_albums_title')</b></h4>
<p>@lang('admin.no_albums_text')</p> <p>@lang('admin.no_albums_text')</p>
<p style="margin-top: 40px;"> <p style="margin-top: 40px;">
<a href="{{ route('albums.create') }}" class="btn btn-lg btn-success">@lang('admin.create_album')</a> <a href="{{ route('albums.create') }}" class="btn btn-lg btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_album')</a>
</p> </p>
</div> </div>
@else @else

View File

@ -36,7 +36,8 @@
@foreach ($groups as $group) @foreach ($groups as $group)
<tr> <tr>
<td> <td>
<span style="font-size: 1.3em;">{{ $group->name }}</span> <span style="font-size: 1.3em;">{{ $group->name }}</span><br/>
<span class="{{ $group->users()->count() == 0 ? "text-danger" : "text-success" }}">{{ trans_choice('admin.group_number_users', $group->users()->count()) }}</span>
</td> </td>
<td class="text-right"> <td class="text-right">
<a href="{{ route('groups.edit', ['id' => $group->id]) }}" class="btn btn-default">@lang('forms.edit_action')</a> <a href="{{ route('groups.edit', ['id' => $group->id]) }}" class="btn btn-default">@lang('forms.edit_action')</a>
@ -52,6 +53,7 @@
</div> </div>
<div class="pull-right" style="margin-top: 10px;"> <div class="pull-right" style="margin-top: 10px;">
<a href="{{ route('users.index') }}" class="btn btn-default">@lang('admin.list_users_title')</a>
<a href="{{ route('groups.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_group')</a> <a href="{{ route('groups.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_group')</a>
</div> </div>
@endif @endif

View File

@ -49,6 +49,7 @@
</div> </div>
<div class="pull-right" style="margin-top: 10px;"> <div class="pull-right" style="margin-top: 10px;">
<a href="{{ route('groups.index') }}" class="btn btn-default">@lang('admin.list_groups_title')</a>
<a href="{{ route('users.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_user')</a> <a href="{{ route('users.create') }}" class="btn btn-success"><i class="fa fa-fw fa-plus"></i> @lang('admin.create_user')</a>
</div> </div>
</div> </div>

View File

@ -203,7 +203,7 @@
<div class="pull-right" style="margin-top: 15px;"> <div class="pull-right" style="margin-top: 15px;">
<a href="{{ route('admin') }}" class="btn btn-default">@lang('forms.cancel_action')</a> <a href="{{ route('admin') }}" class="btn btn-default">@lang('forms.cancel_action')</a>
{!! Form::submit(trans('admin.settings_save_action'), ['class' => 'btn btn-success']) !!} <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-check"></i> @lang('admin.settings_save_action')</button>
</div> </div>
</div> </div>

View File

@ -38,7 +38,7 @@
<div class="text-center" style="margin-top: 30px;"> <div class="text-center" style="margin-top: 30px;">
<h4 class="text-danger"><b>@lang('admin.album_no_photos_p1')</b></h4> <h4 class="text-danger"><b>@lang('admin.album_no_photos_p1')</b></h4>
<p>@lang('admin.album_no_photos_p2')</p> <p>@lang('admin.album_no_photos_p2')</p>
<p style="margin-top: 30px;"><button id="upload-button" class="btn btn-lg btn-success">@lang('admin.album_no_photos_button')</button></p> <p style="margin-top: 30px;"><button id="upload-button" class="btn btn-lg btn-success"><i class="fa fa-fw fa-upload"></i> @lang('admin.album_no_photos_button')</button></p>
</div> </div>
@else @else
{!! Form::open(['route' => ['photos.updateBulk', $album->id], 'method' => 'PUT', 'id' => 'bulk-modify-form']) !!} {!! Form::open(['route' => ['photos.updateBulk', $album->id], 'method' => 'PUT', 'id' => 'bulk-modify-form']) !!}
@ -106,7 +106,7 @@
</div> </div>
<div> <div>
<button type="submit" class="btn btn-success" data-bind="disable: (isUploadInProgress() || isBulkUploadInProgress()), text: isUploadInProgress() ? '@lang('admin.is_uploading')' : '@lang('forms.upload_action')'">@lang('forms.upload_action')</button> <button type="submit" class="btn btn-success" data-bind="disable: (isUploadInProgress() || isBulkUploadInProgress()), text: isUploadInProgress() ? '@lang('admin.is_uploading')' : '@lang('forms.upload_action')'"><i class="fa fa-fw fa-upload"></i> @lang('forms.upload_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
</div> </div>
@ -159,7 +159,7 @@
</div> </div>
<div> <div>
<button type="submit" class="btn btn-success" data-bind="disable: (isUploadInProgress() || isBulkUploadInProgress()), text: isBulkUploadInProgress() ? '@lang('admin.is_uploading')' : '@lang('forms.upload_action')'">@lang('forms.upload_action')</button> <button type="submit" class="btn btn-success" data-bind="disable: (isUploadInProgress() || isBulkUploadInProgress()), text: isBulkUploadInProgress() ? '@lang('admin.is_uploading')' : '@lang('forms.upload_action')'"><i class="fa fa-fw fa-upload"></i> @lang('forms.upload_action')</button>
</div> </div>
{!! Form::close() !!} {!! Form::close() !!}
@endif @endif
@ -218,7 +218,7 @@
<div class="panel-body"> <div class="panel-body">
<p>@lang('admin.save_changes_intro')</p> <p>@lang('admin.save_changes_intro')</p>
<p class="text-right"> <p class="text-right">
<button type="submit" class="btn btn-success">@lang('forms.save_action')</button> <button type="submit" class="btn btn-success"><i class="fa fa-fw fa-floppy-o"></i> @lang('forms.save_action')</button>
</p> </p>
</div> </div>
</div> </div>

View File

@ -4,7 +4,7 @@
<p> <p>
<b>{{ $album_count }}</b> {{ trans_choice('admin.stats_widget.albums', $album_count) }}<br/> <b>{{ $album_count }}</b> {{ trans_choice('admin.stats_widget.albums', $album_count) }}<br/>
<b>{{ $photo_count }}</b> {{ trans_choice('admin.stats_widget.photos', $photo_count) }}<br/> <b>{{ $photo_count }}</b> {{ trans_choice('admin.stats_widget.photos', $photo_count) }}<br/>
<b>{{ $user_count }}</b> {{ trans_choice('admin.stats_widget.users', $user_count) }} <b>{{ $user_count }}</b> {{ trans_choice('admin.stats_widget.users', $user_count) }} / <b>{{ $group_count }}</b> {{ trans_choice('admin.stats_widget.groups', $group_count) }}
</p> </p>
</div> </div>
</div> </div>