From 3af7708933f65bb35c79b0102d297d227fcf77e7 Mon Sep 17 00:00:00 2001 From: Andy Heathershaw Date: Fri, 9 Sep 2016 15:06:34 +0100 Subject: [PATCH] Improved the admin section - added breadcrumb navigation and a nice looking dashboard --- app/AlbumSources/LocalFilesystemSource.php | 5 ++- .../Controllers/Admin/AlbumController.php | 2 +- .../Controllers/Admin/DefaultController.php | 12 +++++- public/themes/bootstrap3/theme.css | 22 ++++++++-- resources/lang/en/admin.php | 34 ++++++++++++--- resources/lang/en/global.php | 5 +-- resources/lang/en/navigation.php | 20 +++++++++ .../themes/base/admin/create_album.blade.php | 13 ++++++ .../themes/base/admin/delete_album.blade.php | 14 +++++++ .../themes/base/admin/edit_album.blade.php | 20 +++++++-- .../views/themes/base/admin/index.blade.php | 35 ++++++++-------- .../themes/base/admin/list_albums.blade.php | 12 ++++++ .../themes/base/admin/settings.blade.php | 12 ++++++ .../themes/base/admin/show_album.blade.php | 17 +++++++- .../views/themes/base/gallery/album.blade.php | 21 ++++++++-- .../views/themes/base/gallery/index.blade.php | 4 +- .../partials/admin_actions_widget.blade.php | 6 +++ .../partials/admin_manage_widget.blade.php | 10 +++++ .../partials/admin_stats_widget.blade.php | 10 +++++ .../partials/admin_sysinfo_widget.blade.php | 41 +++++++++++++++++++ .../themes/base/partials/navbar.blade.php | 17 ++++---- 21 files changed, 277 insertions(+), 55 deletions(-) create mode 100644 resources/lang/en/navigation.php create mode 100644 resources/views/themes/base/partials/admin_actions_widget.blade.php create mode 100644 resources/views/themes/base/partials/admin_manage_widget.blade.php create mode 100644 resources/views/themes/base/partials/admin_stats_widget.blade.php create mode 100644 resources/views/themes/base/partials/admin_sysinfo_widget.blade.php diff --git a/app/AlbumSources/LocalFilesystemSource.php b/app/AlbumSources/LocalFilesystemSource.php index c071b40..3563d1b 100644 --- a/app/AlbumSources/LocalFilesystemSource.php +++ b/app/AlbumSources/LocalFilesystemSource.php @@ -32,7 +32,10 @@ class LocalFilesystemSource implements IAlbumSource public function deleteAlbumContents() { - $this->recursiveDelete($this->getPathToAlbum()); + if (file_exists($this->getPathToAlbum()) && is_dir($this->getPathToAlbum())) + { + $this->recursiveDelete($this->getPathToAlbum()); + } } public function deleteThumbnail(Photo $photo, $thumbnail = null) diff --git a/app/Http/Controllers/Admin/AlbumController.php b/app/Http/Controllers/Admin/AlbumController.php index 6a00afd..e6d72cb 100644 --- a/app/Http/Controllers/Admin/AlbumController.php +++ b/app/Http/Controllers/Admin/AlbumController.php @@ -146,7 +146,7 @@ class AlbumController extends Controller $album->generateAlias(); $album->save(); - return redirect(route('albums.index')); + return redirect(route('albums.show', ['id' => $album->id])); } /** diff --git a/app/Http/Controllers/Admin/DefaultController.php b/app/Http/Controllers/Admin/DefaultController.php index aad9b1b..6449517 100644 --- a/app/Http/Controllers/Admin/DefaultController.php +++ b/app/Http/Controllers/Admin/DefaultController.php @@ -11,6 +11,7 @@ use App\Http\Controllers\Controller; use App\Http\Requests\SaveSettingsRequest; use App\Mail\TestMailConfig; use App\Photo; +use App\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; @@ -25,10 +26,19 @@ class DefaultController extends Controller $albumCount = Album::all()->count(); $photoCount = Photo::all()->count(); + $userCount = User::where('is_activated', true)->count(); return Theme::render('admin.index', [ 'album_count' => $albumCount, - 'photo_count' => $photoCount + 'app_version' => config('app.version'), + 'memory_limit' => ini_get('memory_limit'), + 'photo_count' => $photoCount, + 'php_version' => phpversion(), + 'os_version' => exec('lsb_release -ds 2>/dev/null || cat /etc/*release 2>/dev/null | head -n1 || uname -om'), + 'server_name' => gethostname(), + 'upload_file_size' => ini_get('upload_max_filesize'), + 'upload_max_limit' => ini_get('post_max_size'), + 'user_count' => $userCount ]); } diff --git a/public/themes/bootstrap3/theme.css b/public/themes/bootstrap3/theme.css index b921d6a..292c783 100644 --- a/public/themes/bootstrap3/theme.css +++ b/public/themes/bootstrap3/theme.css @@ -4,12 +4,12 @@ font-family: Raleway, sans-serif; } -body { - padding-bottom: 40px; +.album-container .photo { + margin-bottom: 20px; } -.album-index img { - max-width: 100%; +body { + padding-bottom: 40px; } div.breadcrumb { @@ -31,6 +31,10 @@ ol.breadcrumb { margin-right: 5px; } +.page-title { + margin-top: 0; +} + .panel .progress { margin-top: 20px; margin-bottom: 0; @@ -62,6 +66,16 @@ ol.breadcrumb { font-weight: bold; } +#system-info .meta-label +{ + width: 30%; +} + +#system-info .meta-value +{ + font-weight: bold; +} + .tab-content { border: solid 1px #ddd; border-top: 0; diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 4946dd7..ed01d62 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -1,6 +1,9 @@ 'Actions', + 'actions_widget' => [ + 'create_album_link' => 'Create album', + 'panel_header' => 'Actions', + ], 'album_no_photos_p1' => 'No photos in this album', 'album_no_photos_p2' => 'Click the "Upload photos" button below to get started.', 'album_no_photos_button' => 'Upload photos', @@ -10,19 +13,40 @@ return [ 'create_album' => 'Create a photo album', 'create_album_intro' => 'Photo albums contain individual photographs together in the same way as a physical photo album or memory book.', 'create_album_intro2' => 'Complete the form below to create a photo album.', - 'create_album_link' => 'Create album', 'delete_album' => 'Delete album :name', 'delete_album_confirm' => 'Are you sure you want to permanently delete this album and all its contents?', 'delete_album_warning' => 'This is a permanent action that cannot be undone!', + 'edit_album' => 'Edit photo album: :album_name', + 'edit_album_intro' => 'Photo albums contain individual photographs together in the same way as a physical photo album or memory book.', + 'edit_album_intro2' => 'Complete the form below to edit the properties of the album: :album_name.', 'list_albums_name_column' => 'Album name', + 'manage_widget' => [ + 'panel_header' => 'Manage' + ], 'no_albums_text' => 'You have no photo albums yet. Click the button below to create one.', 'no_albums_title' => 'No Photo Albums', + 'open_album' => 'Open album', 'settings_link' => 'Settings', 'settings_save_action' => 'Update Settings', 'settings_saved_message' => 'The settings were updated successfully.', 'settings_test_email_action' => 'Send a test e-mail', 'settings_title' => 'Settings', - 'stats_albums' => 'album|albums', - 'stats_panel' => 'Statistics', - 'stats_photos' => 'photo|photos' + 'stats_widget' => [ + 'albums' => 'album|albums', + 'panel_header' => 'Statistics', + 'photos' => 'photo|photos', + 'users' => 'user|users', + ], + 'sysinfo_panel' => 'System information', + 'sysinfo_widget' => [ + 'app_version' => 'Blue Twilight version:', + 'hostname' => 'Server name:', + 'memory_limit' => 'Memory limit:', + 'os' => 'Operating system:', + 'php_version' => 'PHP version:', + 'theme' => 'Visual theme:', + 'upload_file_size' => 'Upload limit (each file):', + 'upload_max_limit' => 'Upload limit (maximum size):' + ], + 'title' => 'Gallery Admin' ]; \ No newline at end of file diff --git a/resources/lang/en/global.php b/resources/lang/en/global.php index 5e75c8a..741d2a2 100644 --- a/resources/lang/en/global.php +++ b/resources/lang/en/global.php @@ -1,7 +1,4 @@ 'Blue Twilight', - 'nav_admin' => 'Manage', - 'nav_admin_control' => 'Control Panel', - 'nav_admin_albums' => 'Albums' + 'app_name' => 'Blue Twilight' ]; \ No newline at end of file diff --git a/resources/lang/en/navigation.php b/resources/lang/en/navigation.php new file mode 100644 index 0000000..deb5fb1 --- /dev/null +++ b/resources/lang/en/navigation.php @@ -0,0 +1,20 @@ + [ + 'admin' => 'Admin', + 'albums' => 'Albums', + 'create_album' => 'Create album', + 'delete_album' => 'Delete album', + 'edit_album' => 'Edit album', + 'home' => 'Gallery', + 'settings' => 'Settings', + 'users' => 'Users' + ], + 'navbar' => [ + 'admin' => 'Manage', + 'albums' => 'Albums', + 'login' => 'Login', + 'logout' => 'Logout', + 'register' => 'Register' + ] +]; \ No newline at end of file diff --git a/resources/views/themes/base/admin/create_album.blade.php b/resources/views/themes/base/admin/create_album.blade.php index 280ede5..5f5e2bb 100644 --- a/resources/views/themes/base/admin/create_album.blade.php +++ b/resources/views/themes/base/admin/create_album.blade.php @@ -1,6 +1,19 @@ @extends('themes.base.layout') @section('title', 'Gallery Admin') +@section('breadcrumb') + +@endsection + @section('content')
diff --git a/resources/views/themes/base/admin/delete_album.blade.php b/resources/views/themes/base/admin/delete_album.blade.php index 998cea0..7fb725f 100644 --- a/resources/views/themes/base/admin/delete_album.blade.php +++ b/resources/views/themes/base/admin/delete_album.blade.php @@ -1,6 +1,20 @@ @extends('themes.base.layout') @section('title', trans('admin.delete_album', ['name' => $album->name])) +@section('breadcrumb') + +@endsection + @section('content')
diff --git a/resources/views/themes/base/admin/edit_album.blade.php b/resources/views/themes/base/admin/edit_album.blade.php index d4cdd87..2008620 100644 --- a/resources/views/themes/base/admin/edit_album.blade.php +++ b/resources/views/themes/base/admin/edit_album.blade.php @@ -1,13 +1,27 @@ @extends('themes.base.layout') @section('title', 'Gallery Admin') +@section('breadcrumb') + +@endsection + @section('content')
-

@lang('admin.create_album')

-

@lang('admin.create_album_intro')

-

@lang('admin.create_album_intro2')

+

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

+

@lang('admin.edit_album_intro')

+

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


@if (count($errors) > 0) diff --git a/resources/views/themes/base/admin/index.blade.php b/resources/views/themes/base/admin/index.blade.php index 952eb12..30a4764 100644 --- a/resources/views/themes/base/admin/index.blade.php +++ b/resources/views/themes/base/admin/index.blade.php @@ -1,31 +1,28 @@ @extends('themes.base.layout') @section('title', 'Gallery Admin') +@section('breadcrumb') + +@endsection + @section('content')
-
-
-
@lang('admin.stats_panel')
-
-

- - {{ $album_count }} {{ trans_choice('admin.stats_albums', $album_count) }} -
- {{ $photo_count }} {{ trans_choice('admin.stats_photos', $photo_count) }} -

-
-
+
+ @include (Theme::viewName('partials.admin_sysinfo_widget'))
-
-
@lang('admin.actions_panel')
- -
+ @include (Theme::viewName('partials.admin_actions_widget')) + @include (Theme::viewName('partials.admin_manage_widget')) + @include (Theme::viewName('partials.admin_stats_widget'))
diff --git a/resources/views/themes/base/admin/list_albums.blade.php b/resources/views/themes/base/admin/list_albums.blade.php index a8775a6..85beb92 100644 --- a/resources/views/themes/base/admin/list_albums.blade.php +++ b/resources/views/themes/base/admin/list_albums.blade.php @@ -1,6 +1,18 @@ @extends('themes.base.layout') @section('title', 'Gallery Admin') +@section('breadcrumb') + +@endsection + @section('content')
diff --git a/resources/views/themes/base/admin/settings.blade.php b/resources/views/themes/base/admin/settings.blade.php index f7156ff..8c82892 100644 --- a/resources/views/themes/base/admin/settings.blade.php +++ b/resources/views/themes/base/admin/settings.blade.php @@ -1,6 +1,18 @@ @extends('themes.base.layout') @section('title', trans('admin.settings_title')) +@section('breadcrumb') + +@endsection + @section('content')
diff --git a/resources/views/themes/base/admin/show_album.blade.php b/resources/views/themes/base/admin/show_album.blade.php index 96a9194..309f58c 100644 --- a/resources/views/themes/base/admin/show_album.blade.php +++ b/resources/views/themes/base/admin/show_album.blade.php @@ -1,11 +1,26 @@ @extends('themes.base.layout') @section('title', $album->name) +@section('breadcrumb') + +@endsection + @section('content')
-

{{ $album->name }}

+ @lang('admin.open_album') + +

{{ $album->name }}

{{ $album->description }}


diff --git a/resources/views/themes/base/gallery/album.blade.php b/resources/views/themes/base/gallery/album.blade.php index 9696690..9080a22 100644 --- a/resources/views/themes/base/gallery/album.blade.php +++ b/resources/views/themes/base/gallery/album.blade.php @@ -1,5 +1,5 @@ @extends('themes.base.layout') -@section('title', 'Welcome') +@section('title', $album->name) @section('breadcrumb')