From: Louis Jeckel Date: Mon, 4 May 2020 17:18:35 +0000 (+0200) Subject: glide + block editor X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=4ff401ed3981cfacad011c1dead83ce82f6a480a;p=psq.git glide + block editor --- diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index 500e9ad..22121ce 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -14,12 +14,11 @@ class ImageController extends Controller { public function show($path) { - \Debugbar::disable(); - return "a"; + $server = ServerFactory::create([ - 'response' => new LaravelResponseFactory($request), + 'response' => new LaravelResponseFactory(request()), 'source' => Storage::cloud()->getDriver(), - 'cache' => $filesystem->getDriver(), + 'cache' => Storage::getDriver(), 'cache_path_prefix' => '.cache', 'base_url' => 'images', 'driver' => 'imagick', @@ -27,18 +26,7 @@ class ImageController extends Controller ]); - $img = $server->makeImage($path, request()->all()); - -// $file = Storage::get($img); -// $type = Storage::mimeType($img); -// -// $response = Response::make($file, 200); -// -// $response->header("Content-Type", $type); - -// return $response; - - \Image::make($filesystem->get($img))->response(); +// return \Image::make(Storage::get($server->makeImage($path, request()->all())))->response(); return $server->getImageResponse($path, request()->all()); diff --git a/app/Models/AdCampaign.php b/app/Models/AdCampaign.php index b07026a..ac5ea65 100644 --- a/app/Models/AdCampaign.php +++ b/app/Models/AdCampaign.php @@ -27,33 +27,14 @@ class AdCampaign extends Model implements Sortable ]; public $mediasParams = [ - 'cover' => [ - 'desktop' => [ + 'image' => [ + 'preview' => [ [ - 'name' => 'desktop', + 'name' => 'Miniature', 'ratio' => 16 / 9, ], ], - 'mobile' => [ - [ - 'name' => 'mobile', - 'ratio' => 1, - ], - ], - 'flexible' => [ - [ - 'name' => 'free', - 'ratio' => 0, - ], - [ - 'name' => 'landscape', - 'ratio' => 16 / 9, - ], - [ - 'name' => 'portrait', - 'ratio' => 3 / 5, - ], - ], + ], ]; } diff --git a/config/cors.php b/config/cors.php index 558369d..3e9813e 100644 --- a/config/cors.php +++ b/config/cors.php @@ -12,10 +12,11 @@ return [ | in web browsers. You are free to adjust these settings as needed. | | To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS + @todo SET THIS | */ - 'paths' => ['api/*'], + 'paths' => ['/*'], 'allowed_methods' => ['*'], diff --git a/config/twill-navigation.php b/config/twill-navigation.php index 55db34d..7edf0d4 100644 --- a/config/twill-navigation.php +++ b/config/twill-navigation.php @@ -12,25 +12,18 @@ return [ 'route' => '/publish', 'raw' => true ], - 'pdfFiles' => [ - 'title' => 'PdfFiles', - 'module' => true - ], 'adCampaigns' => [ - 'title' => 'AdCampaigns', + 'title' => 'Campagnes publicitaires', 'module' => true ], 'events' => [ - 'title' => 'Events', + 'title' => 'Evénements', 'module' => true ], 'articles' => [ - 'title' => 'Articles', - 'module' => true + 'title' => 'Articles', + 'module' => true ], - - - 'featured' => [ 'title' => 'Features', 'route' => 'admin.featured.homepage', @@ -43,5 +36,4 @@ return [ ], - ]; diff --git a/config/twill.php b/config/twill.php index e9449d8..2a84735 100644 --- a/config/twill.php +++ b/config/twill.php @@ -210,6 +210,64 @@ return [ 'media_library' => [ 'image_service' => \A17\Twill\Services\MediaLibrary\Glide::class, - ] + ], + 'block_editor' => [ + 'block_single_layout' => 'site.layouts.block', // layout to use when rendering a single block in the editor + 'block_views_path' => 'site.blocks', // path where a view file per block type is stored + 'block_views_mappings' => [], // custom mapping of block types and views + 'block_preview_render_childs' => true, // indicates if childs should be rendered when using repeater in blocks + 'block_presenter_path' => null, // allow to set a custom presenter to a block model + // Indicates if blocks templates should be inlined in HTML. + // When setting to false, make sure to build Twill with your all your custom blocks using php artisan twill:build. + 'inline_blocks_templates' => true, + 'custom_vue_blocks_resource_path' => 'assets/js/blocks', // path to custom vue blocks in your resources directory + 'blocks' => [ + 'text' => [ + 'title' => 'Body text', + 'icon' => 'text', + 'component' => 'a17-block-wysiwyg', + ], + 'image' => [ + 'title' => 'Image', + 'icon' => 'image', + 'component' => 'a17-block-image', + ], + ], + 'crops' => [ + 'image' => [ + 'desktop' => [ + [ + 'name' => 'desktop', + 'ratio' => 16 / 9, + 'minValues' => [ + 'width' => 100, + 'height' => 100, + ], + ], + ], + 'tablet' => [ + [ + 'name' => 'tablet', + 'ratio' => 4 / 3, + 'minValues' => [ + 'width' => 100, + 'height' => 100, + ], + ], + ], + 'mobile' => [ + [ + 'name' => 'mobile', + 'ratio' => 1, + 'minValues' => [ + 'width' => 100, + 'height' => 100, + ], + ], + ], + ], + ], + 'repeaters' => [], + ], ]; diff --git a/database/migrations/2020_05_02_130334_create_events_tables.php b/database/migrations/2020_05_02_130334_create_events_tables.php index 62227ae..8513fc3 100644 --- a/database/migrations/2020_05_02_130334_create_events_tables.php +++ b/database/migrations/2020_05_02_130334_create_events_tables.php @@ -17,7 +17,7 @@ class CreateEventsTables extends Migration // your generated model and form include a description field, to get you started, but feel free to get rid of it if you don't need it $table->text('description')->nullable(); - $table->dateTime('start_date'); + $table->dateTime('start_date')->nullable(); $table->dateTime('end_date')->nullable(); $table->string('organizer')->nullable(); diff --git a/resources/views/admin/articles/form.blade.php b/resources/views/admin/articles/form.blade.php index 2dd200d..5088779 100644 --- a/resources/views/admin/articles/form.blade.php +++ b/resources/views/admin/articles/form.blade.php @@ -6,7 +6,5 @@ 'label' => 'Description', 'maxlength' => 400 ]) - @formField('block_editor', [ - 'blocks' => ['title', 'quote', 'text', 'image', 'grid', 'test', 'publications', 'news'] - ]) + @formField('block_editor') @stop diff --git a/resources/views/site/blocks/text.blade.php b/resources/views/site/blocks/text.blade.php new file mode 100644 index 0000000..885022f --- /dev/null +++ b/resources/views/site/blocks/text.blade.php @@ -0,0 +1 @@ +{!! $block->input('html') !!} diff --git a/resources/views/site/layouts/block.blade.php b/resources/views/site/layouts/block.blade.php new file mode 100644 index 0000000..7653476 --- /dev/null +++ b/resources/views/site/layouts/block.blade.php @@ -0,0 +1,6 @@ +@extends('layouts.app', ['hideNav' => true]) + +@section('content') + @yield('content') +@endsection +