Update status edit view

This commit is contained in:
Daniel Supernault 2020-01-29 23:04:25 -07:00
parent d366adab7d
commit 28bc9c1923
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 13 additions and 9 deletions

View file

@ -978,6 +978,9 @@ class ApiV1Controller extends Controller
} }
} }
$filterClass = in_array($request->input('filter_class'), Filter::classes()) ? $request->input('filter_class') : null;
$filterName = in_array($request->input('filter_name'), Filter::names()) ? $request->input('filter_name') : null;
$monthHash = hash('sha1', date('Y').date('m')); $monthHash = hash('sha1', date('Y').date('m'));
$userHash = hash('sha1', $user->id . (string) $user->created_at); $userHash = hash('sha1', $user->id . (string) $user->created_at);
@ -1001,8 +1004,8 @@ class ApiV1Controller extends Controller
$media->size = $photo->getSize(); $media->size = $photo->getSize();
$media->mime = $photo->getMimeType(); $media->mime = $photo->getMimeType();
$media->caption = $request->input('description'); $media->caption = $request->input('description');
$media->filter_class = $request->input('filter_class'); $media->filter_class = $filterClass;
$media->filter_name = $request->input('filter_name'); $media->filter_name = $filterName;
$media->save(); $media->save();
switch ($media->mime) { switch ($media->mime) {

View file

@ -24,6 +24,7 @@ use App\Transformer\Api\{
StatusTransformer StatusTransformer
}; };
use League\Fractal; use League\Fractal;
use App\Util\Media\Filter;
use League\Fractal\Serializer\ArraySerializer; use League\Fractal\Serializer\ArraySerializer;
use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use App\Jobs\AvatarPipeline\AvatarOptimize; use App\Jobs\AvatarPipeline\AvatarOptimize;
@ -231,6 +232,9 @@ class BaseApiController extends Controller
} }
} }
$filterClass = in_array($request->input('filter_class'), Filter::classes()) ? $request->input('filter_class') : null;
$filterName = in_array($request->input('filter_name'), Filter::names()) ? $request->input('filter_name') : null;
$monthHash = hash('sha1', date('Y').date('m')); $monthHash = hash('sha1', date('Y').date('m'));
$userHash = hash('sha1', $user->id . (string) $user->created_at); $userHash = hash('sha1', $user->id . (string) $user->created_at);
@ -253,8 +257,8 @@ class BaseApiController extends Controller
$media->original_sha256 = $hash; $media->original_sha256 = $hash;
$media->size = $photo->getSize(); $media->size = $photo->getSize();
$media->mime = $photo->getMimeType(); $media->mime = $photo->getMimeType();
$media->filter_class = $request->input('filter_class'); $media->filter_class = $filterClass;
$media->filter_name = $request->input('filter_name'); $media->filter_name = $filterName;
$media->save(); $media->save();
$url = URL::temporarySignedRoute( $url = URL::temporarySignedRoute(

View file

@ -38,7 +38,7 @@
@csrf @csrf
<input type="hidden" name="media_id" value="{{$media->id}}"> <input type="hidden" name="media_id" value="{{$media->id}}">
<div class="filter-wrapper {{$media->filter_class}}" data-filter="{{$media->filter_class}}"> <div class="filter-wrapper {{$media->filter_class}}" data-filter="{{$media->filter_class}}">
<img class="img-fluid" src="{{$media->thumbnailUrl()}}" width="100%"> <img class="img-fluid" src="{{$media->url()}}" width="100%">
</div> </div>
<div class="p-3"> <div class="p-3">
<div class="form-group"> <div class="form-group">
@ -69,12 +69,9 @@
@endsection @endsection
@push('scripts') @push('scripts')
<script type="text/javascript" src="{{ mix('js/compose.js') }}"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
new Vue({ App.boot();
el: '#content'
});
$('.form-filters').each(function(i,d) { $('.form-filters').each(function(i,d) {
let el = $(d); let el = $(d);
let filter = el.data('filter'); let filter = el.data('filter');