diff --git a/app/Album.php b/app/Album.php index 3b9559c..8e7b130 100644 --- a/app/Album.php +++ b/app/Album.php @@ -70,8 +70,14 @@ class Album extends Model { return $this->getAlbumSource()->getUrlToPhoto($photo, $thumbnailName); } - - return ''; + + // Rotate standard images + $images = [ + asset('themes/base/images/empty-album-1.jpg'), + asset('themes/base/images/empty-album-2.jpg'), + asset('themes/base/images/empty-album-3.jpg') + ]; + return $images[rand(0, count($images) - 1)]; } public function url() diff --git a/app/Http/Controllers/Gallery/AlbumController.php b/app/Http/Controllers/Gallery/AlbumController.php index 3050cbe..4c91269 100644 --- a/app/Http/Controllers/Gallery/AlbumController.php +++ b/app/Http/Controllers/Gallery/AlbumController.php @@ -38,17 +38,23 @@ class AlbumController extends Controller $this->authorizeForUser($this->getUser(), 'album.view', $album); - // The slideshow view needs access to all photos, not paged - $photos = $album->photos() - ->orderBy(DB::raw('COALESCE(taken_at, created_at)')); - - if ($requestedView != 'slideshow') + if ($album->photos()->count() == 0) { - $photos = $photos->paginate(UserConfig::get('items_per_page')); + $requestedView = 'empty'; + $photos = []; + } + else if ($requestedView != 'slideshow') + { + $photos = $album->photos() + ->orderBy(DB::raw('COALESCE(taken_at, created_at)')) + ->paginate(UserConfig::get('items_per_page')); } else { - $photos = $photos->get(); + // The slideshow view needs access to all photos, not paged + $photos = $album->photos() + ->orderBy(DB::raw('COALESCE(taken_at, created_at)')) + ->get(); } return Theme::render(sprintf('gallery.album_%s', $requestedView), [ diff --git a/public/themes/base/images/empty-album-1.jpg b/public/themes/base/images/empty-album-1.jpg new file mode 100644 index 0000000..ff790c5 Binary files /dev/null and b/public/themes/base/images/empty-album-1.jpg differ diff --git a/public/themes/base/images/empty-album-2.jpg b/public/themes/base/images/empty-album-2.jpg new file mode 100644 index 0000000..5f4542b Binary files /dev/null and b/public/themes/base/images/empty-album-2.jpg differ diff --git a/public/themes/base/images/empty-album-3.jpg b/public/themes/base/images/empty-album-3.jpg new file mode 100644 index 0000000..2615add Binary files /dev/null and b/public/themes/base/images/empty-album-3.jpg differ diff --git a/public/themes/base/images/smartphone-photo.jpg b/public/themes/base/images/smartphone-photo.jpg new file mode 100644 index 0000000..93141e8 Binary files /dev/null and b/public/themes/base/images/smartphone-photo.jpg differ diff --git a/public/themes/base/images/take-a-photo.jpg b/public/themes/base/images/take-a-photo.jpg new file mode 100644 index 0000000..5f32135 Binary files /dev/null and b/public/themes/base/images/take-a-photo.jpg differ diff --git a/public/themes/bootstrap3/images/empty-fuel-gauge.jpg b/public/themes/bootstrap3/images/empty-fuel-gauge.jpg deleted file mode 100644 index 08371c8..0000000 Binary files a/public/themes/bootstrap3/images/empty-fuel-gauge.jpg and /dev/null differ diff --git a/resources/lang/en/gallery.php b/resources/lang/en/gallery.php index 975089d..76e9752 100644 --- a/resources/lang/en/gallery.php +++ b/resources/lang/en/gallery.php @@ -1,10 +1,13 @@ 'Let\'s get snapping!', + 'album_no_results_text' => 'This album is currently empty. If you are the owner of this album, you can upload photos using the :admin_link.', + 'album_no_results_text_2' => 'Did you know you can upload photos straight from your smartphone or tablet. Simply access the above link on your device.', 'album_views' => [ 'default' => 'Default', 'slideshow' => 'Slideshow' ], 'back_to_album' => 'Back to :name', - 'index_no_results_heading' => 'This gallery is empty!', - 'index_no_results_text' => 'If you are the owner of this gallery, you can create new albums and upload photos using the :admin_link.' + 'index_no_results_heading' => 'Start something amazing', + 'index_no_results_text' => 'This gallery is currently empty. If you are the owner of this gallery, you can create new albums and upload photos using the :admin_link.' ]; \ No newline at end of file diff --git a/resources/views/themes/base/gallery/album_empty.blade.php b/resources/views/themes/base/gallery/album_empty.blade.php new file mode 100644 index 0000000..0fc1388 --- /dev/null +++ b/resources/views/themes/base/gallery/album_empty.blade.php @@ -0,0 +1,27 @@ +@extends('themes.base.layout') +@section('title', $album->name) + +@section('breadcrumb') + +@endsection + +@section('content') +
+
+
+

@lang('gallery.album_no_results_heading')

+

@lang('gallery.album_no_results_text', ['admin_link' => sprintf('%s', route('admin'), trans('admin.title'))])

+

@lang('gallery.album_no_results_text_2')

+ + +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/themes/base/gallery/index.blade.php b/resources/views/themes/base/gallery/index.blade.php index 4fbb059..22f80f0 100644 --- a/resources/views/themes/base/gallery/index.blade.php +++ b/resources/views/themes/base/gallery/index.blade.php @@ -27,11 +27,11 @@ @endforeach @else -
- - +

@lang('gallery.index_no_results_heading')

-

@lang('gallery.index_no_results_text', ['admin_link' => sprintf('%s', route('admin'), trans('admin.title'))])

+

@lang('gallery.index_no_results_text', ['admin_link' => sprintf('%s', route('admin'), trans('admin.title'))])

+ +
@endif