#16: Added a tab to the album admin screen to display a list of cameras used in that album
This commit is contained in:
parent
dda12a47e4
commit
89d9c31ba8
@ -8,6 +8,7 @@ use App\Helpers\MiscHelper;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class Album extends Model
|
||||
@ -56,6 +57,19 @@ class Album extends Model
|
||||
return $this->belongsToMany(Permission::class, 'album_anonymous_permissions');
|
||||
}
|
||||
|
||||
public function cameras()
|
||||
{
|
||||
return DB::table('photos')
|
||||
->where('album_id', $this->id)
|
||||
->groupBy('camera_make', 'camera_model', 'camera_software')
|
||||
->select('camera_make', 'camera_model', 'camera_software', DB::raw('count(*) as photo_count'))
|
||||
->orderBy('photo_count', 'desc')
|
||||
->orderBy('camera_make')
|
||||
->orderBy('camera_model')
|
||||
->orderBy('camera_software')
|
||||
->get();
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(Album::class, 'parent_album_id')->withCount('photos');
|
||||
|
@ -350,6 +350,9 @@ class AlbumController extends Controller
|
||||
$request->session()->flash('_old_input', $album->toArray());
|
||||
}
|
||||
|
||||
// Get the cameras used in this album
|
||||
$cameras = $album->cameras();
|
||||
|
||||
return Theme::render('admin.show_album', [
|
||||
'active_tab' => (strlen($activeTab) == 0) ? 'photos' : $activeTab,
|
||||
'album' => $album,
|
||||
@ -368,6 +371,7 @@ class AlbumController extends Controller
|
||||
'refresh_thumbnails' => trans('admin.photo_actions.refresh_thumbnails'),
|
||||
'delete' => trans('admin.photo_actions.delete')
|
||||
],
|
||||
'cameras' => $cameras,
|
||||
'error' => $request->session()->get('error'),
|
||||
'existing_groups' => $existingGroups,
|
||||
'existing_users' => $existingUsers,
|
||||
|
@ -8,6 +8,15 @@ return [
|
||||
'album_appearance_intro' => 'The settings shown below control how this album appears to visitors in the gallery.',
|
||||
'album_basic_info_heading' => 'Album information',
|
||||
'album_basic_info_intro' => 'The album\'s name and description are displayed to visitors in the gallery. If you wish to change them, you can do so below.',
|
||||
'album_camera_make' => 'Manufacturer',
|
||||
'album_camera_model' => 'Model',
|
||||
'album_camera_photo_count' => 'Number of photos',
|
||||
'album_camera_software' => 'Software version',
|
||||
'album_cameras_heading' => 'Cameras used in this album',
|
||||
'album_cameras_tab' => 'Cameras',
|
||||
'album_cameras_text' => 'Blue Twilight analyses the Exif data in your photos to determine which cameras have been used. The cameras that were found are displayed below.',
|
||||
'album_no_cameras_found_p1' => 'No cameras were found',
|
||||
'album_no_cameras_found_p2' => 'Upload more photos to this album or ensure the cameras you use support Exif image tagging.',
|
||||
'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_p2_no_upload' => 'The album\'s owner has not uploaded any photos yet.',
|
||||
|
@ -27,6 +27,7 @@
|
||||
@can('change-permissions', $album)
|
||||
@include(Theme::viewName('partials.tab'), ['tab_name' => 'permissions', 'tab_icon' => 'lock', 'tab_text' => trans('admin.album_security_tab')])
|
||||
@endcan
|
||||
@include(Theme::viewName('partials.tab'), ['tab_name' => 'cameras', 'tab_icon' => 'camera', 'tab_text' => trans('admin.album_cameras_tab')])
|
||||
@include(Theme::viewName('partials.tab'), ['tab_name' => 'settings', 'tab_icon' => 'cog', 'tab_text' => trans('admin.album_settings_tab')])
|
||||
</ul>
|
||||
|
||||
@ -41,6 +42,8 @@
|
||||
{{-- Permissions --}}
|
||||
@include(Theme::viewName('partials.album_permissions_tab'))
|
||||
@endcan
|
||||
{{-- Cameras --}}
|
||||
@include(Theme::viewName('partials.album_cameras_tab'))
|
||||
{{-- Settings --}}
|
||||
@include(Theme::viewName('partials.album_settings_tab'))
|
||||
</div>
|
||||
|
@ -0,0 +1,31 @@
|
||||
<div role="tabpanel" class="tab-pane{{ $active_tab == 'cameras' ? ' active' : '' }}" id="cameras-tab">
|
||||
@if (count($cameras) == 0)
|
||||
<div class="text-center" style="margin-top: 15px;">
|
||||
<h4 class="text-danger"><b>@lang('admin.album_no_cameras_found_p1')</b></h4>
|
||||
<p>@lang('admin.album_no_cameras_found_p2')</p>
|
||||
</div>
|
||||
@else
|
||||
<h4>@lang('admin.album_cameras_heading')</h4>
|
||||
<p>@lang('admin.album_cameras_text')</p>
|
||||
<table class="table table-striped table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@lang('admin.album_camera_make')</th>
|
||||
<th>@lang('admin.album_camera_model')</th>
|
||||
<th>@lang('admin.album_camera_software')</th>
|
||||
<th>@lang('admin.album_camera_photo_count')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($cameras as $camera)
|
||||
<tr>
|
||||
<td>{{ $camera->camera_make }}</td>
|
||||
<td>{{ $camera->camera_model }}</td>
|
||||
<td>{{ $camera->camera_software }}</td>
|
||||
<td>{{ $camera->photo_count }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
@ -1,5 +1,4 @@
|
||||
@php ($field_prefix = sprintf('photo[%d]', $photo->id))
|
||||
<hr/>
|
||||
<div class="photo row" data-photo-id="{{ $photo->id }}">
|
||||
<div class="col-sm-2">
|
||||
<div class="loading"><img src="{{ asset('ripple.svg') }}" /></div>
|
||||
@ -72,3 +71,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
Loading…
Reference in New Issue
Block a user