2016-09-02 10:42:05 +01:00
|
|
|
@extends('themes.base.layout')
|
2016-09-01 16:37:49 +01:00
|
|
|
@section('title', $album->name)
|
|
|
|
|
2016-09-09 15:06:34 +01:00
|
|
|
@section('breadcrumb')
|
|
|
|
<div class="breadcrumb">
|
|
|
|
<div class="container">
|
|
|
|
<ol class="breadcrumb">
|
|
|
|
<li><a href="{{ route('home') }}">@lang('navigation.breadcrumb.home')</a></li>
|
|
|
|
<li><a href="{{ route('admin') }}">@lang('navigation.breadcrumb.admin')</a></li>
|
|
|
|
<li><a href="{{ route('albums.index') }}">@lang('navigation.breadcrumb.albums')</a></li>
|
|
|
|
<li class="active">{{ $album->name }}</li>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
|
2016-09-01 16:37:49 +01:00
|
|
|
@section('content')
|
|
|
|
<div class="container">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-xs-12">
|
2016-09-09 15:06:34 +01:00
|
|
|
<a class="pull-right btn btn-default" href="{{ $album->url() }}" target="_blank"><i class="fa fa-fw fa-eye"></i> @lang('admin.open_album')</a>
|
|
|
|
|
|
|
|
<h1 class="page-title">{{ $album->name }}</h1>
|
2016-09-01 16:37:49 +01:00
|
|
|
<p>{{ $album->description }}</p>
|
|
|
|
<hr/>
|
2016-09-02 21:27:50 +01:00
|
|
|
|
|
|
|
<div>
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
2016-09-06 15:07:13 +01:00
|
|
|
<li role="presentation" class="active"><a href="#photos-tab" aria-controls="photos-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-photo"></i> @lang('admin.album_photos_tab')</a></li>
|
|
|
|
<li role="presentation"><a href="#upload-tab" aria-controls="upload-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-upload"></i> @lang('admin.album_upload_tab')</a></li>
|
|
|
|
<li role="presentation"><a href="#settings-tab" aria-controls="settings-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-cog"></i> @lang('admin.album_settings_tab')</a></li>
|
2016-09-02 21:27:50 +01:00
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="tab-content">
|
2016-09-06 15:07:13 +01:00
|
|
|
{{-- Photos --}}
|
|
|
|
<div role="tabpanel" class="tab-pane active" id="photos-tab">
|
2016-09-07 21:44:28 +01:00
|
|
|
@if (count($photos) == 0)
|
2016-09-06 15:07:13 +01:00
|
|
|
<div class="text-center" style="margin-top: 30px;">
|
2016-09-06 19:47:25 +01:00
|
|
|
<h4 class="text-danger"><b>@lang('admin.album_no_photos_p1')</b></h4>
|
2016-09-06 15:07:13 +01:00
|
|
|
<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>
|
|
|
|
</div>
|
2016-09-07 21:44:28 +01:00
|
|
|
@else
|
|
|
|
{!! Form::open(['route' => ['photos.updateBulk', $album->id], 'method' => 'PUT']) !!}
|
|
|
|
|
|
|
|
@foreach ($photos as $photo)
|
|
|
|
@include (Theme::viewName('partials.single_photo_admin'))
|
|
|
|
@endforeach
|
|
|
|
|
2016-09-11 09:04:07 +01:00
|
|
|
<div class="pull-left">
|
|
|
|
<p>{!! Form::label('bulk-action', trans('forms.bulk_edit_photos_label'), ['class' => 'control-label']) !!}</p>
|
|
|
|
{!! Form::select('bulk-action', $bulk_actions, null, ['placeholder' => trans('forms.bulk_edit_photos_placeholder'), 'id' => 'bulk-action-apply']) !!}
|
|
|
|
<button type="submit" class="btn btn-sm btn-success" name="bulk-apply" value="clicked">@lang('forms.apply_action')</button>
|
|
|
|
</div>
|
2016-09-07 21:44:28 +01:00
|
|
|
<div class="pull-right">
|
|
|
|
<button type="submit" class="btn btn-success">@lang('forms.save_action')</button>
|
|
|
|
</div>
|
|
|
|
<div class="clearfix"></div>
|
|
|
|
|
|
|
|
{!! Form::close() !!}
|
|
|
|
|
|
|
|
<div class="text-center">
|
|
|
|
{{ $photos->links() }}
|
|
|
|
</div>
|
2016-09-06 15:07:13 +01:00
|
|
|
@endif
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{{-- Upload --}}
|
|
|
|
<div role="tabpanel" class="tab-pane" id="upload-tab">
|
2016-09-24 08:17:51 +01:00
|
|
|
@if (!$is_upload_enabled)
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-xs-12">
|
|
|
|
<p class="text-danger" style="font-weight: bold">@lang('admin.upload_disabled_heading')</p>
|
|
|
|
<p>@lang('admin.upload_disabled_text')</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@else
|
|
|
|
<h4>@lang('admin.upload_single_file_heading')</h4>
|
|
|
|
<p>@lang('admin.upload_single_file_text')</p>
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<p>@lang('admin.upload_single_file_text2', [
|
|
|
|
'file_size' => sprintf('<b>%s%s</b>', round($file_upload_limit, 2), trans('global.units.megabytes')),
|
|
|
|
'max_upload_size' => sprintf('<b>%s%s</b>', round($max_post_limit, 2), trans('global.units.megabytes'))
|
|
|
|
])</p>
|
|
|
|
</div>
|
2016-09-02 21:27:50 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-5" style="margin-bottom: 20px;">
|
|
|
|
{!! Form::open(['route' => 'photos.store', 'method' => 'POST', 'files' => true, 'id' => 'single-upload-form']) !!}
|
|
|
|
{!! Form::hidden('album_id', $album->id) !!}
|
2016-09-02 21:27:50 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<div class="form-group">
|
|
|
|
{!! Form::file('photo[]', ['class' => 'control-label', 'multiple' => 'multiple', 'id' => 'single-upload-files']) !!}
|
|
|
|
</div>
|
2016-09-02 21:27:50 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
{!! Form::close() !!}
|
2016-09-11 09:04:07 +01:00
|
|
|
</div>
|
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<div class="col-sm-5">
|
|
|
|
<div class="text-center" data-bind="visible: isUploadInProgress">
|
|
|
|
<p><b>@lang('admin.is_uploading')</b></p>
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar progress-bar-success" data-bind="style: { width: successfulPercentage() }">
|
|
|
|
<span class="sr-only"><span class="percentage-success" data-bind="text: successfulPercentage"></span></span>
|
|
|
|
</div>
|
|
|
|
<div class="progress-bar progress-bar-danger" data-bind="style: { width: failedPercentage() }">
|
|
|
|
<span class="sr-only"><span class="percentage-danger" data-bind="text: failedPercentage"></span></span>
|
|
|
|
</div>
|
2016-09-22 07:34:18 +01:00
|
|
|
</div>
|
2016-09-24 08:17:51 +01:00
|
|
|
<p data-bind="text: currentStatus"></p>
|
2016-09-11 09:04:07 +01:00
|
|
|
</div>
|
2016-09-22 07:34:18 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<div data-bind="visible: statusMessages().length > 0">
|
|
|
|
<p data-bind="visible: !isUploadInProgress()" class="text-danger" style="font-weight: bold">
|
|
|
|
<span data-bind="text: imagesFailed"></span> @lang('admin.upload_file_number_failed')
|
|
|
|
</p>
|
|
|
|
<p data-bind="visible: imagesUploaded() > 0">
|
|
|
|
@lang('admin.upload_file_failed_continue')<br /><br/>
|
|
|
|
<a href="{{ route('albums.analyse', ['id' => $album->id]) }}" class="btn btn-primary">@lang('forms.continue_action')</a>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<ul data-bind="foreach: statusMessages">
|
|
|
|
<li data-bind="css: message_class, text: message_text"></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2016-09-11 09:04:07 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-05 12:56:13 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<hr/>
|
|
|
|
<h4>@lang('admin.upload_bulk_heading')</h4>
|
|
|
|
<p>@lang('admin.upload_bulk_text')</p>
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<p>@lang('admin.upload_bulk_text2', [
|
|
|
|
'max_upload_size' => sprintf('<b>%s%s</b>', round($max_post_limit_bulk, 2), trans('global.units.megabytes'))
|
|
|
|
])</p>
|
|
|
|
</div>
|
2016-09-05 12:56:13 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
{!! Form::open(['route' => 'photos.storeBulk', 'method' => 'POST', 'files' => true, 'id' => 'bulk-upload-form']) !!}
|
|
|
|
{!! Form::hidden('album_id', $album->id) !!}
|
2016-09-05 12:56:13 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<div class="form-group">
|
|
|
|
{!! Form::file('archive', ['class' => 'control-label']) !!}
|
|
|
|
</div>
|
2016-09-05 12:56:13 +01:00
|
|
|
|
2016-09-24 08:17:51 +01:00
|
|
|
<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>
|
|
|
|
</div>
|
|
|
|
{!! Form::close() !!}
|
|
|
|
@endif
|
2016-09-02 21:27:50 +01:00
|
|
|
</div>
|
|
|
|
|
2016-09-06 15:07:13 +01:00
|
|
|
{{-- Settings --}}
|
2016-09-02 21:27:50 +01:00
|
|
|
<div role="tabpanel" class="tab-pane" id="settings-tab">
|
2016-09-06 15:07:13 +01:00
|
|
|
<div class="btn-toolbar">
|
|
|
|
<a href="{{ route('albums.edit', ['id' => $album->id]) }}" class="btn btn-default">@lang('forms.edit_action')</a>
|
|
|
|
<a href="{{ route('albums.delete', ['id' => $album->id]) }}" class="btn btn-danger">@lang('forms.delete_action')</a>
|
|
|
|
</div>
|
2016-09-02 21:27:50 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-01 16:37:49 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-06 15:07:13 +01:00
|
|
|
@endsection
|
|
|
|
|
|
|
|
@push('scripts')
|
|
|
|
<script type="text/javascript">
|
2016-09-22 07:34:18 +01:00
|
|
|
var language = [];
|
|
|
|
language.image_failed = '{!! addslashes(trans('admin.upload_file_status_failed')) !!}';
|
|
|
|
language.image_uploaded = '{!! addslashes(trans('admin.upload_file_status_success')) !!}';
|
|
|
|
language.upload_status = '{!! addslashes(trans('admin.upload_file_status_progress')) !!}';
|
|
|
|
|
|
|
|
var urls = [];
|
|
|
|
urls.analyse = '{{ route('albums.analyse', ['id' => $album->id]) }}';
|
|
|
|
|
|
|
|
var viewModel = new UploadPhotosViewModel('{{ $album->id }}', language, urls);
|
2016-09-11 09:04:07 +01:00
|
|
|
|
2016-09-09 09:45:11 +01:00
|
|
|
function deletePhoto(photo_id, parent)
|
|
|
|
{
|
|
|
|
var url = '{{ route('photos.destroy', ['id' => 0]) }}';
|
|
|
|
url = url.replace(/\/0$/, '/' + photo_id);
|
|
|
|
|
|
|
|
$('.loading', parent).show();
|
|
|
|
|
|
|
|
$.post(url, {'_method': 'DELETE'}, function(data)
|
|
|
|
{
|
|
|
|
window.location.reload();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function regenerateThumbnails(photo_id, parent)
|
|
|
|
{
|
|
|
|
var url = '{{ route('photos.regenerateThumbnails', ['id' => 0]) }}';
|
|
|
|
url = url.replace(/\/0$/, '/' + photo_id);
|
|
|
|
|
|
|
|
$('.loading', parent).show();
|
|
|
|
$.post(url, function()
|
|
|
|
{
|
|
|
|
var image = $('img.photo-thumbnail', parent);
|
|
|
|
var originalUrl = image.data('original-src');
|
|
|
|
image.attr('src', originalUrl + "&_=" + new Date().getTime());
|
|
|
|
|
|
|
|
$('.loading', parent).hide();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-08 23:22:29 +01:00
|
|
|
function rotatePhoto(photo_id, angle, parent)
|
|
|
|
{
|
|
|
|
var url = '{{ route('photos.rotate', ['id' => 0, 'angle' => 1]) }}';
|
|
|
|
url = url.replace('/0/', '/' + photo_id + '/');
|
|
|
|
url = url.replace(/\/1$/, '/' + angle);
|
|
|
|
|
2016-09-09 09:45:11 +01:00
|
|
|
$('.loading', parent).show();
|
2016-09-08 23:22:29 +01:00
|
|
|
$.post(url, function()
|
|
|
|
{
|
|
|
|
var image = $('img.photo-thumbnail', parent);
|
|
|
|
var originalUrl = image.data('original-src');
|
|
|
|
image.attr('src', originalUrl + "&_=" + new Date().getTime());
|
2016-09-09 09:45:11 +01:00
|
|
|
|
|
|
|
$('.loading', parent).hide();
|
2016-09-08 23:22:29 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2016-09-06 15:07:13 +01:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('#upload-button').click(function() {
|
|
|
|
$('.nav-tabs a[href="#upload-tab"]').tab('show');
|
|
|
|
});
|
2016-09-08 23:22:29 +01:00
|
|
|
|
2016-09-09 09:45:11 +01:00
|
|
|
{{-- Photo editing tasks - the buttons beneath the photos in partials/single_photo_admin --}}
|
|
|
|
$('a.delete-photo').click(function() {
|
|
|
|
var parent = $(this).parents('.photo');
|
|
|
|
var photo_id = $(parent).data('photo-id');
|
|
|
|
|
|
|
|
$(this).dropdown('toggle');
|
|
|
|
|
|
|
|
bootbox.dialog({
|
|
|
|
message: 'Are you sure you want to delete this photo? This cannot be undone!',
|
|
|
|
title: 'Delete photo',
|
|
|
|
buttons: {
|
|
|
|
cancel: {
|
|
|
|
label: "Cancel",
|
|
|
|
className: "btn-default"
|
|
|
|
},
|
|
|
|
confirm: {
|
|
|
|
label: "Delete",
|
|
|
|
className: "btn-danger",
|
|
|
|
callback: function() {
|
|
|
|
deletePhoto(photo_id, parent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
$('a.regenerate-thumbnails').click(function() {
|
|
|
|
var parent = $(this).parents('.photo');
|
|
|
|
var photo_id = $(parent).data('photo-id');
|
|
|
|
|
|
|
|
regenerateThumbnails(photo_id, parent);
|
|
|
|
$(this).dropdown('toggle');
|
|
|
|
return false;
|
|
|
|
});
|
2016-09-08 23:22:29 +01:00
|
|
|
$('a.rotate-photo-left').click(function() {
|
|
|
|
var parent = $(this).parents('.photo');
|
|
|
|
var photo_id = $(parent).data('photo-id');
|
|
|
|
|
|
|
|
rotatePhoto(photo_id, 90, parent);
|
|
|
|
$(this).dropdown('toggle');
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
$('a.rotate-photo-right').click(function() {
|
|
|
|
var parent = $(this).parents('.photo');
|
|
|
|
var photo_id = $(parent).data('photo-id');
|
|
|
|
|
|
|
|
rotatePhoto(photo_id, 270, parent);
|
|
|
|
$(this).dropdown('toggle');
|
|
|
|
return false;
|
|
|
|
});
|
2016-09-11 09:04:07 +01:00
|
|
|
|
|
|
|
{{-- Photo uploads using AJAX --}}
|
|
|
|
if (window.FormData)
|
|
|
|
{
|
|
|
|
$('#single-upload-form').submit(function(event) {
|
|
|
|
var fileSelect = $('#single-upload-files', this);
|
|
|
|
var uploadButton = $('button[type=submit]', this);
|
|
|
|
|
|
|
|
// Get the selected files
|
|
|
|
var notImageString = '{!! addslashes(trans('admin.upload_file_not_image_messages')) !!}';
|
|
|
|
var files = fileSelect[0].files;
|
|
|
|
|
|
|
|
// Reset statistics
|
2016-09-22 07:34:18 +01:00
|
|
|
viewModel.startUpload(files.length);
|
2016-09-11 09:04:07 +01:00
|
|
|
|
|
|
|
// Loop through each of the selected files and upload them individually
|
|
|
|
for (var i = 0; i < files.length; i++)
|
|
|
|
{
|
|
|
|
var file = files[i];
|
|
|
|
|
|
|
|
// We're only interested in image files
|
|
|
|
if (!file.type.match('image.*'))
|
|
|
|
{
|
|
|
|
alert(notImageString.replace(':file_name', file.name));
|
2016-09-24 08:17:51 +01:00
|
|
|
viewModel.onUploadFailed(null, file.name);
|
2016-09-11 09:04:07 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Upload the file
|
2016-09-22 07:34:18 +01:00
|
|
|
viewModel.uploadFile($(this), file);
|
2016-09-11 09:04:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Prevent standard form upload
|
|
|
|
event.preventDefault();
|
|
|
|
return false;
|
2016-09-22 07:34:18 +01:00
|
|
|
});
|
2016-09-24 08:17:51 +01:00
|
|
|
|
|
|
|
$('#bulk-upload-form').submit(function(event) {
|
|
|
|
// Set the in progress flag - no need to unset it as this is a synchronous process so the browser
|
|
|
|
// will reload the page in some way after completion
|
|
|
|
viewModel.isBulkUploadInProgress(true);
|
|
|
|
return true;
|
|
|
|
});
|
2016-09-11 09:04:07 +01:00
|
|
|
}
|
2016-09-22 07:34:18 +01:00
|
|
|
|
|
|
|
ko.applyBindings(viewModel);
|
2016-09-06 15:07:13 +01:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
@endpush
|