From dc770c6c1f103eddbb4543265a9df3af2e335d97 Mon Sep 17 00:00:00 2001 From: Louis Jeckel Date: Tue, 4 Aug 2020 14:45:14 +0200 Subject: [PATCH] try json repeater --- .idea/blade.xml | 89 +++++++++++++++++++ .idea/dictionaries/Louis.xml | 1 + .../Controllers/Admin/PodcastController.php | 10 +++ app/Http/Requests/Admin/PodcastRequest.php | 18 ++++ app/Models/Podcast.php | 43 +++++++++ app/Models/Slugs/PodcastSlug.php | 10 +++ app/Repositories/PodcastRepository.php | 23 +++++ composer.lock | 13 +-- config/twill-navigation.php | 5 ++ config/twill.php | 19 +++- ...20_08_04_093907_create_podcasts_tables.php | 42 +++++++++ .../views/admin/adCampaigns/form.blade.php | 1 + resources/views/admin/blocks/guests.blade.php | 22 +++++ resources/views/admin/podcasts/form.blade.php | 56 ++++++++++++ resources/views/components/nav.blade.php | 2 +- routes/admin.php | 1 + 16 files changed, 347 insertions(+), 8 deletions(-) create mode 100644 .idea/blade.xml create mode 100644 app/Http/Controllers/Admin/PodcastController.php create mode 100644 app/Http/Requests/Admin/PodcastRequest.php create mode 100644 app/Models/Podcast.php create mode 100644 app/Models/Slugs/PodcastSlug.php create mode 100644 app/Repositories/PodcastRepository.php create mode 100644 database/migrations/2020_08_04_093907_create_podcasts_tables.php create mode 100644 resources/views/admin/blocks/guests.blade.php create mode 100644 resources/views/admin/podcasts/form.blade.php diff --git a/.idea/blade.xml b/.idea/blade.xml new file mode 100644 index 0000000..cc88888 --- /dev/null +++ b/.idea/blade.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dictionaries/Louis.xml b/.idea/dictionaries/Louis.xml index 2a6c35a..24e8316 100644 --- a/.idea/dictionaries/Louis.xml +++ b/.idea/dictionaries/Louis.xml @@ -2,6 +2,7 @@ mailgun + podcast webhook webhooks diff --git a/app/Http/Controllers/Admin/PodcastController.php b/app/Http/Controllers/Admin/PodcastController.php new file mode 100644 index 0000000..c1ed748 --- /dev/null +++ b/app/Http/Controllers/Admin/PodcastController.php @@ -0,0 +1,10 @@ + 'array' + ]; + + public $slugAttributes = [ + 'title', + ]; + + public $mediasParams = [ + 'sponsor_logo' => [ + 'logo' => [ + [ + 'name' => 'logo', + 'ratio' => 0, + ], + ], + ], + ]; +} diff --git a/app/Models/Slugs/PodcastSlug.php b/app/Models/Slugs/PodcastSlug.php new file mode 100644 index 0000000..8224f9a --- /dev/null +++ b/app/Models/Slugs/PodcastSlug.php @@ -0,0 +1,10 @@ +model = $model; + } +} diff --git a/composer.lock b/composer.lock index e07c5d0..3b5ee1f 100644 --- a/composer.lock +++ b/composer.lock @@ -120,16 +120,16 @@ }, { "name": "area17/twill", - "version": "2.0.1", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/area17/twill.git", - "reference": "4e19670cb62b9baeb37354c3998ce05add97328c" + "reference": "b420c6954250d18ad0446e65003715ef9ae8dca7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/area17/twill/zipball/4e19670cb62b9baeb37354c3998ce05add97328c", - "reference": "4e19670cb62b9baeb37354c3998ce05add97328c", + "url": "https://api.github.com/repos/area17/twill/zipball/b420c6954250d18ad0446e65003715ef9ae8dca7", + "reference": "b420c6954250d18ad0446e65003715ef9ae8dca7", "shasum": "" }, "require": { @@ -156,8 +156,9 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.16", "kalnoy/nestedset": "^5.0", + "nunomaduro/collision": "^3.0|^4.2", "orchestra/testbench": "~3.3|~3.4|~3.5|~3.6|~3.7|~3.8|^4.0|^5.0", - "phpunit/phpunit": "~5.0|~6.0|~7.0|~8.0" + "phpunit/phpunit": "~5.0|~6.0|~7.0|~8.0|~9.0" }, "type": "library", "extra": { @@ -194,7 +195,7 @@ "laravel", "twill" ], - "time": "2020-03-10T13:05:42+00:00" + "time": "2020-07-20T13:54:38+00:00" }, { "name": "asm89/stack-cors", diff --git a/config/twill-navigation.php b/config/twill-navigation.php index 89e30f5..18a37d7 100644 --- a/config/twill-navigation.php +++ b/config/twill-navigation.php @@ -31,6 +31,11 @@ return [ 'title' => 'Articles', 'module' => true ], + 'podcasts' => [ + 'title' => 'Podcasts', + 'module' => true + ] + ] ], diff --git a/config/twill.php b/config/twill.php index 3ab429e..7f2de7b 100644 --- a/config/twill.php +++ b/config/twill.php @@ -251,8 +251,19 @@ return [ 'icon' => 'image', 'component' => 'a17-block-image', ], + 'guest' => [ + 'title' => 'Invité', + 'icon' => 'image', + 'component' => 'a17-block-guest' + ] ], 'crops' => [ + 'profile' => [ + 'profile' => [ + 'name' => 'profile', + 'ratio' => 1 + ] + ], 'image' => [ 'desktop' => [ [ @@ -286,7 +297,13 @@ return [ ], ], ], - 'repeaters' => [], + 'repeaters' => [ + 'guests' => [ + 'title' => 'Invités', + 'trigger' => 'Ajotuer des invités', + 'component' => 'a17-block-guests', + ] + ], ], ]; diff --git a/database/migrations/2020_08_04_093907_create_podcasts_tables.php b/database/migrations/2020_08_04_093907_create_podcasts_tables.php new file mode 100644 index 0000000..4152209 --- /dev/null +++ b/database/migrations/2020_08_04_093907_create_podcasts_tables.php @@ -0,0 +1,42 @@ +string('title', 200)->nullable(); + + // 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(); + + // add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date) + $table->timestamp('publish_start_date')->nullable(); + // $table->timestamp('publish_end_date')->nullable(); + + $table->string('sponsor')->nullable(); + $table->string('sponsor_url')->nullable(); + + }); + + Schema::create('podcast_slugs', function (Blueprint $table) { + createDefaultSlugsTableFields($table, 'podcast'); + }); + + + } + + public function down() + { + + Schema::dropIfExists('podcast_slugs'); + Schema::dropIfExists('podcasts'); + } +} diff --git a/resources/views/admin/adCampaigns/form.blade.php b/resources/views/admin/adCampaigns/form.blade.php index 9868a29..d182db9 100644 --- a/resources/views/admin/adCampaigns/form.blade.php +++ b/resources/views/admin/adCampaigns/form.blade.php @@ -20,4 +20,5 @@ 'name' => 'image', 'label' => 'Image', ]) + @stop diff --git a/resources/views/admin/blocks/guests.blade.php b/resources/views/admin/blocks/guests.blade.php new file mode 100644 index 0000000..4625413 --- /dev/null +++ b/resources/views/admin/blocks/guests.blade.php @@ -0,0 +1,22 @@ + +@twillRepeaterTitle('Invité') +@twillRepeaterTrigger('Ajouter un invité') +@twillRepeaterGroup('app') +@formField('medias', [ + 'name' => 'image', + 'label' => 'Photo', + 'withVideoUrl' => false, + 'max' => 1, +]) +@formField('input', [ + 'name' => 'name', + 'label' => 'Nom', + 'maxlength' => 250, + 'translated' => false, +]) +@formField('input', [ + 'name' => 'job', + 'label' => 'Fonction', + 'maxlength' => 250, + 'translated' => false, +]) diff --git a/resources/views/admin/podcasts/form.blade.php b/resources/views/admin/podcasts/form.blade.php new file mode 100644 index 0000000..f77c9ca --- /dev/null +++ b/resources/views/admin/podcasts/form.blade.php @@ -0,0 +1,56 @@ +@extends('twill::layouts.form', [ + 'additionalFieldsets' => [ + [ + 'fieldset' => 'guests', + 'label' => 'Invités' + ], + [ + 'fieldset' => 'sponsor', + 'label' => 'Partenaire', + ] + ] +]) + +@section('contentFields') + @formField('input', [ + 'name' => 'description', + 'label' => 'Sommaire', + 'maxlength' => 600, + 'type' => 'textarea', + 'required' => true, + 'rows' => 5 + ]) +@stop + +@section('fieldsets') + + @component('twill::partials.form.utils._fieldset', ['id' => 'guests', 'title' => 'Invités']) + @formField('repeater', ['type' => 'guests']) + + @endcomponent + + @component('twill::partials.form.utils._fieldset', ['id' => 'sponsor', 'title' => 'Partenaires']) + + @formField('input', [ + 'name' => 'sponsor', + 'label' => 'Nom du partenaire', + 'hint' => 'Une émission en partenariat avec...', + ]) + + @formField('input', [ + 'name' => 'sponsor_url', + 'label' => 'Site web', + 'hint' => 'https://', + ]) + + @formField('medias', [ + 'name' => 'sponsor_logo', + 'label' => 'Logo', + 'max' => 1, + + ]) + + + @endcomponent + +@stop diff --git a/resources/views/components/nav.blade.php b/resources/views/components/nav.blade.php index fded5c8..3cb2154 100644 --- a/resources/views/components/nav.blade.php +++ b/resources/views/components/nav.blade.php @@ -6,7 +6,7 @@
- + Pill Icon

Campagnes
&
Com­munication

diff --git a/routes/admin.php b/routes/admin.php index f9ee98c..660c632 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -6,6 +6,7 @@ Route::group(['prefix' => 'content'], function() { Route::module('articles'); Route::module('adCampaigns'); Route::module('events'); + Route::module('podcasts'); }); -- 2.39.5