diff --git a/app/Group.php b/app/Group.php index 2b60450..195e49d 100644 --- a/app/Group.php +++ b/app/Group.php @@ -14,4 +14,9 @@ class Group extends Model protected $fillable = [ 'name' ]; + + public function users() + { + return $this->belongsToMany(User::class, 'user_groups'); + } } \ No newline at end of file diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index f46acc2..d61e0d1 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -6,6 +6,7 @@ use App\Album; use App\Configuration; use App\Facade\Theme; use App\Facade\UserConfig; +use App\Group; use App\Helpers\ConfigHelper; use App\Http\Controllers\Controller; use App\Http\Requests\SaveSettingsRequest; @@ -33,11 +34,13 @@ class DefaultController extends Controller $albumCount = Album::all()->count(); $photoCount = Photo::all()->count(); + $groupCount = Group::all()->count(); $userCount = User::where('is_activated', true)->count(); return Theme::render('admin.index', [ 'album_count' => $albumCount, 'app_version' => config('app.version'), + 'group_count' => $groupCount, 'memory_limit' => ini_get('memory_limit'), 'photo_count' => $photoCount, 'php_version' => phpversion(), diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 9613678..91411d3 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -72,6 +72,11 @@ return [ 'edit_user_title' => 'Edit user account: :name', 'group_deletion_failed' => 'An error occurred while removing the ":name" group: :error_message', '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.', 'is_uploading' => 'Uploading in progress...', 'legend' => 'Legend/Key', @@ -127,6 +132,7 @@ return [ 'settings_title' => 'Settings', 'stats_widget' => [ 'albums' => 'album|albums', + 'groups' => 'group|groups', 'panel_header' => 'Statistics', 'photos' => 'photo|photos', 'users' => 'user|users', diff --git a/resources/views/themes/base/admin/create_album.blade.php b/resources/views/themes/base/admin/create_album.blade.php index 21739d1..69fa3a2 100644 --- a/resources/views/themes/base/admin/create_album.blade.php +++ b/resources/views/themes/base/admin/create_album.blade.php @@ -54,7 +54,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} +
{!! Form::close() !!} diff --git a/resources/views/themes/base/admin/create_group.blade.php b/resources/views/themes/base/admin/create_group.blade.php index 40bcc79..6afbfab 100644 --- a/resources/views/themes/base/admin/create_group.blade.php +++ b/resources/views/themes/base/admin/create_group.blade.php @@ -38,7 +38,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} +
diff --git a/resources/views/themes/base/admin/create_storage.blade.php b/resources/views/themes/base/admin/create_storage.blade.php index 1d9068e..488cfb3 100644 --- a/resources/views/themes/base/admin/create_storage.blade.php +++ b/resources/views/themes/base/admin/create_storage.blade.php @@ -180,7 +180,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} +
{!! Form::close() !!} diff --git a/resources/views/themes/base/admin/create_user.blade.php b/resources/views/themes/base/admin/create_user.blade.php index 4b720c0..59a6cae 100644 --- a/resources/views/themes/base/admin/create_user.blade.php +++ b/resources/views/themes/base/admin/create_user.blade.php @@ -88,7 +88,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.create_action'), ['class' => 'btn btn-success']) !!} +
{!! Form::close() !!} diff --git a/resources/views/themes/base/admin/delete_album.blade.php b/resources/views/themes/base/admin/delete_album.blade.php index ba3b0e2..bfa3084 100644 --- a/resources/views/themes/base/admin/delete_album.blade.php +++ b/resources/views/themes/base/admin/delete_album.blade.php @@ -21,13 +21,13 @@

@yield('title')

@lang('admin.delete_album_confirm', ['name' => $album->name])

-
+
@lang('admin.delete_album_warning')
{!! Form::open(['route' => ['albums.destroy', $album->id], 'method' => 'DELETE']) !!} @lang('forms.cancel_action') - {!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} + {!! Form::close() !!}
diff --git a/resources/views/themes/base/admin/delete_group.blade.php b/resources/views/themes/base/admin/delete_group.blade.php index 6e08bf5..f93d78e 100644 --- a/resources/views/themes/base/admin/delete_group.blade.php +++ b/resources/views/themes/base/admin/delete_group.blade.php @@ -26,7 +26,7 @@
{!! Form::open(['route' => ['groups.destroy', $group->id], 'method' => 'DELETE']) !!} @lang('forms.cancel_action') - {!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} + {!! Form::close() !!}
diff --git a/resources/views/themes/base/admin/delete_storage.blade.php b/resources/views/themes/base/admin/delete_storage.blade.php index c0763a0..c419e0f 100644 --- a/resources/views/themes/base/admin/delete_storage.blade.php +++ b/resources/views/themes/base/admin/delete_storage.blade.php @@ -20,13 +20,13 @@

@yield('title')

@lang('admin.delete_storage_confirm', ['name' => $storage->name])

-
+
@lang('admin.delete_storage_warning')
{!! Form::open(['route' => ['storage.destroy', $storage->id], 'method' => 'DELETE']) !!} @lang('forms.cancel_action') - {!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} + {!! Form::close() !!}
diff --git a/resources/views/themes/base/admin/delete_user.blade.php b/resources/views/themes/base/admin/delete_user.blade.php index d20fcc2..e43b64a 100644 --- a/resources/views/themes/base/admin/delete_user.blade.php +++ b/resources/views/themes/base/admin/delete_user.blade.php @@ -26,7 +26,7 @@
{!! Form::open(['route' => ['users.destroy', $user->id], 'method' => 'DELETE']) !!} @lang('forms.cancel_action') - {!! Form::submit(trans('forms.delete_action'), ['class' => 'btn btn-danger']) !!} + {!! Form::close() !!}
diff --git a/resources/views/themes/base/admin/edit_album.blade.php b/resources/views/themes/base/admin/edit_album.blade.php index 6c06fa9..57f63da 100644 --- a/resources/views/themes/base/admin/edit_album.blade.php +++ b/resources/views/themes/base/admin/edit_album.blade.php @@ -43,7 +43,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} +
{!! Form::close() !!} diff --git a/resources/views/themes/base/admin/edit_group.blade.php b/resources/views/themes/base/admin/edit_group.blade.php index 9543fb8..c5dd9a1 100644 --- a/resources/views/themes/base/admin/edit_group.blade.php +++ b/resources/views/themes/base/admin/edit_group.blade.php @@ -23,22 +23,51 @@
{!! Form::model($group, ['route' => ['groups.update', $group->id], 'method' => 'PUT']) !!} -
-
-
- {!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!} - {!! Form::text('name', old('name'), ['class' => 'form-control']) !!} +
+ {{-- Nav tabs --}} + - @if ($errors->has('name')) - - {{ $errors->first('name') }} - - @endif + {{-- Tab panes --}} +
+ {{-- Details --}} +
+
+
+
+ {!! Form::label('name', trans('forms.name_label'), ['class' => 'control-label']) !!} + {!! Form::text('name', old('name'), ['class' => 'form-control']) !!} + + @if ($errors->has('name')) + + {{ $errors->first('name') }} + + @endif +
+ +
+ @lang('forms.cancel_action') + +
+
+
-
- @lang('forms.cancel_action') - {!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} + {{-- Users --}} +
+ @if ($group->users()->count() > 0) +

@lang('admin.group_users_message', ['group_name' => $group->name])

+ + @else +

@lang('admin.group_no_users_message')

+

@lang('admin.users_title')

+ @endif
diff --git a/resources/views/themes/base/admin/edit_storage.blade.php b/resources/views/themes/base/admin/edit_storage.blade.php index f13ad05..c83c029 100644 --- a/resources/views/themes/base/admin/edit_storage.blade.php +++ b/resources/views/themes/base/admin/edit_storage.blade.php @@ -65,7 +65,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} +
{!! Form::close() !!}
diff --git a/resources/views/themes/base/admin/edit_user.blade.php b/resources/views/themes/base/admin/edit_user.blade.php index 6fdc71b..9ecfa7d 100644 --- a/resources/views/themes/base/admin/edit_user.blade.php +++ b/resources/views/themes/base/admin/edit_user.blade.php @@ -127,7 +127,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('forms.save_action'), ['class' => 'btn btn-success']) !!} +
{!! Form::close() !!} diff --git a/resources/views/themes/base/admin/list_albums.blade.php b/resources/views/themes/base/admin/list_albums.blade.php index 2a909a9..cae0fd1 100644 --- a/resources/views/themes/base/admin/list_albums.blade.php +++ b/resources/views/themes/base/admin/list_albums.blade.php @@ -27,7 +27,7 @@

@lang('admin.no_albums_title')

@lang('admin.no_albums_text')

- @lang('admin.create_album') + @lang('admin.create_album')

@else diff --git a/resources/views/themes/base/admin/list_groups.blade.php b/resources/views/themes/base/admin/list_groups.blade.php index 6f5cb45..506e384 100644 --- a/resources/views/themes/base/admin/list_groups.blade.php +++ b/resources/views/themes/base/admin/list_groups.blade.php @@ -36,7 +36,8 @@ @foreach ($groups as $group) - {{ $group->name }} + {{ $group->name }}
+ {{ trans_choice('admin.group_number_users', $group->users()->count()) }} @lang('forms.edit_action') @@ -52,6 +53,7 @@
+ @lang('admin.list_users_title') @lang('admin.create_group')
@endif diff --git a/resources/views/themes/base/admin/list_users.blade.php b/resources/views/themes/base/admin/list_users.blade.php index e2cb90f..d23dedb 100644 --- a/resources/views/themes/base/admin/list_users.blade.php +++ b/resources/views/themes/base/admin/list_users.blade.php @@ -49,6 +49,7 @@
+ @lang('admin.list_groups_title') @lang('admin.create_user')
diff --git a/resources/views/themes/base/admin/settings.blade.php b/resources/views/themes/base/admin/settings.blade.php index 1376d69..a590a5f 100644 --- a/resources/views/themes/base/admin/settings.blade.php +++ b/resources/views/themes/base/admin/settings.blade.php @@ -203,7 +203,7 @@
@lang('forms.cancel_action') - {!! Form::submit(trans('admin.settings_save_action'), ['class' => 'btn btn-success']) !!} +
diff --git a/resources/views/themes/base/admin/show_album.blade.php b/resources/views/themes/base/admin/show_album.blade.php index 3a0a2bd..19b672e 100644 --- a/resources/views/themes/base/admin/show_album.blade.php +++ b/resources/views/themes/base/admin/show_album.blade.php @@ -38,7 +38,7 @@

@lang('admin.album_no_photos_p1')

@lang('admin.album_no_photos_p2')

-

+

@else {!! Form::open(['route' => ['photos.updateBulk', $album->id], 'method' => 'PUT', 'id' => 'bulk-modify-form']) !!} @@ -106,7 +106,7 @@
- +
{!! Form::close() !!} @@ -159,7 +159,7 @@
- +
{!! Form::close() !!} @endif @@ -218,7 +218,7 @@

@lang('admin.save_changes_intro')

- +

diff --git a/resources/views/themes/base/partials/admin_stats_widget.blade.php b/resources/views/themes/base/partials/admin_stats_widget.blade.php index a9c6611..3fc9b0b 100644 --- a/resources/views/themes/base/partials/admin_stats_widget.blade.php +++ b/resources/views/themes/base/partials/admin_stats_widget.blade.php @@ -4,7 +4,7 @@

{{ $album_count }} {{ trans_choice('admin.stats_widget.albums', $album_count) }}
{{ $photo_count }} {{ trans_choice('admin.stats_widget.photos', $photo_count) }}
- {{ $user_count }} {{ trans_choice('admin.stats_widget.users', $user_count) }} + {{ $user_count }} {{ trans_choice('admin.stats_widget.users', $user_count) }} / {{ $group_count }} {{ trans_choice('admin.stats_widget.groups', $group_count) }}

\ No newline at end of file