#2: Added a loading animation to the quick-post/upload function whilst uploading

This commit is contained in:
Andy Heathershaw 2017-09-10 15:46:16 +01:00
parent fee2841910
commit c2e9fe617b
5 changed files with 36 additions and 3 deletions

View File

@ -15,6 +15,7 @@ use App\Http\Requests\SaveSettingsRequest;
use App\Label; use App\Label;
use App\Mail\TestMailConfig; use App\Mail\TestMailConfig;
use App\Photo; use App\Photo;
use App\Storage;
use App\User; use App\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
@ -78,8 +79,24 @@ class DefaultController extends Controller
$albumID = $request->get('album_id'); $albumID = $request->get('album_id');
if (intval($albumID) == 0) if (intval($albumID) == 0)
{ {
$request->session()->flash('error', trans('admin.quick_upload.no_album_selected')); $albumName = trim($request->get('album_name'));
return redirect($returnUrl); if (strlen($albumName) == 0)
{
$request->session()->flash('error', trans('admin.quick_upload.no_album_selected'));
return redirect($returnUrl);
}
$albumViews = UserConfig::allowedAlbumViews();
$album = new Album();
$album->storage_id = Storage::where('is_default', true)->first()->id;
$album->user_id = Auth::user()->id;
$album->default_view = UserConfig::get('default_album_view');
$album->name = $albumName;
$album->description = '';
$album->save();
$request->request->set('album_id', $album->id);
} }
/** @var PhotoController $photoController */ /** @var PhotoController $photoController */

View File

@ -14,6 +14,7 @@ return [
'cancel_action' => 'Cancel', 'cancel_action' => 'Cancel',
'continue_action' => 'Continue', 'continue_action' => 'Continue',
'create_action' => 'Create', 'create_action' => 'Create',
'create_album_label' => 'Create a new album:',
'default_album_view_label' => 'Default view mode in the gallery:', 'default_album_view_label' => 'Default view mode in the gallery:',
'default_storage_label' => 'Use as the default storage location for new albums', 'default_storage_label' => 'Use as the default storage location for new albums',
'delete_action' => 'Delete', 'delete_action' => 'Delete',

View File

@ -15,6 +15,7 @@ return [
'powered_by' => 'Powered by :link_startBlue Twilight:link_end - the self-hosted PHP photo gallery software.', 'powered_by' => 'Powered by :link_startBlue Twilight:link_end - the self-hosted PHP photo gallery software.',
'quick_upload' => [ 'quick_upload' => [
'intro' => 'Use the quick upload feature to quickly add a new photo to an album.', 'intro' => 'Use the quick upload feature to quickly add a new photo to an album.',
'or' => '- or -',
'title' => 'Quick Upload' 'title' => 'Quick Upload'
], ],
'units' => [ 'units' => [

View File

@ -118,6 +118,15 @@
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
} }
}); });
// Quick upload
$(document).ready(function()
{
$('#quick-upload-form').submit(function()
{
$('.modal-footer', '#quick-upload-modal').html('<center><img src="{{ asset('ripple.svg') }}"/></center>');
});
});
</script> </script>
@stack('scripts') @stack('scripts')
{!! \App\Facade\UserConfig::get('analytics_code') !!} {!! \App\Facade\UserConfig::get('analytics_code') !!}

View File

@ -1,4 +1,4 @@
<form method="POST" action="{{ route('admin.quickUpload') }}" enctype="multipart/form-data"> <form method="POST" action="{{ route('admin.quickUpload') }}" enctype="multipart/form-data" id="quick-upload-form">
{{ csrf_field() }} {{ csrf_field() }}
<input type="hidden" name="queue_token" value="{{ Misc::randomString() }}"/> <input type="hidden" name="queue_token" value="{{ Misc::randomString() }}"/>
<div class="modal" id="quick-upload-modal"> <div class="modal" id="quick-upload-modal">
@ -26,6 +26,11 @@
<option value="{{ $album->id }}">{{ $album->name }}</option> <option value="{{ $album->id }}">{{ $album->name }}</option>
@endforeach @endforeach
</select> </select>
<div class="text-center">@lang('global.quick_upload.or')</div>
<label class="control-label" for="quick-upload-album-name">@lang('forms.create_album_label')</label>
<input type="text" name="album_name" class="form-control" id="quick-upload-album-name" />
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">