From 8562e875fd6a6f5fc33e08a6ffaac858358da319 Mon Sep 17 00:00:00 2001 From: Louis Jeckel Date: Sat, 15 Aug 2020 12:03:08 +0200 Subject: [PATCH] podcasts coups de cour com v2 --- app/Http/Controllers/PodcastController.php | 2 +- app/Models/Podcast.php | 35 +++++++++- config/twill-navigation.php | 9 +-- ...020_08_15_083028_change_podcasts_table.php | 45 +++++++++++++ public/css/app.css | 1 - resources/sass/app.scss | 1 - resources/views/admin/blocks/image.blade.php | 5 ++ resources/views/admin/podcasts/form.blade.php | 66 +++++++++++++++++++ .../views/admin/settings/podcasts.blade.php | 64 ------------------ .../{index.blade.php => show.blade.php} | 18 ++--- resources/views/site/blocks/image.blade.php | 9 +++ routes/admin.php | 2 +- 12 files changed, 171 insertions(+), 86 deletions(-) create mode 100644 database/migrations/2020_08_15_083028_change_podcasts_table.php delete mode 100644 resources/views/admin/settings/podcasts.blade.php rename resources/views/podcasts/{index.blade.php => show.blade.php} (83%) diff --git a/app/Http/Controllers/PodcastController.php b/app/Http/Controllers/PodcastController.php index 7291ce1..e90d776 100644 --- a/app/Http/Controllers/PodcastController.php +++ b/app/Http/Controllers/PodcastController.php @@ -12,6 +12,6 @@ class PodcastController extends Controller public function index() { \View::share('podcast', Podcast::published()->visible()->orderByDesc('id')->first()); - return view('podcasts.index'); + return view('podcasts.show'); } } diff --git a/app/Models/Podcast.php b/app/Models/Podcast.php index 7f67dc2..163e360 100644 --- a/app/Models/Podcast.php +++ b/app/Models/Podcast.php @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\Storage; class Podcast extends Model { - use HasSlug, HasMedias, HasFiles; + use HasSlug, HasMedias, HasFiles, HasBlocks; protected $fillable = [ 'published', @@ -20,7 +20,14 @@ class Podcast extends Model 'description', 'sponsor', 'sponsor_url', - 'publish_start_date' + 'publish_start_date', + 'coup_de_coeur_text', + 'coup_de_coeur_link', + 'coup_de_com_text', + 'coup_de_com_link', + 'journal_com_text', + 'journal_com_link', + ]; @@ -37,6 +44,30 @@ class Podcast extends Model ], ], ], + 'coup_de_coeur_img' => [ + 'logo' => [ + [ + 'name' => 'logo', + 'ratio' => 0, + ], + ], + ], + 'coup_de_com_img' => [ + 'logo' => [ + [ + 'name' => 'logo', + 'ratio' => 0, + ], + ], + ], + 'journal_com_img' => [ + 'logo' => [ + [ + 'name' => 'logo', + 'ratio' => 0, + ], + ], + ], ]; public $fileParams = [ diff --git a/config/twill-navigation.php b/config/twill-navigation.php index a39fee1..dce7278 100644 --- a/config/twill-navigation.php +++ b/config/twill-navigation.php @@ -70,20 +70,15 @@ return [ 'params' => ['section' => 'strings'], ], - 'podcasts' => [ - 'title' => 'Podcasts', - 'route' => 'admin.settings', - 'params' => ['section' => 'podcasts'], - ], 'pillBoxSpaces' => [ 'title' => 'Emplacement encadrés', 'module' => true ] ] ], - 'other_content' => [ + 'other-content.socialArticles' => [ 'title' => 'Autre contenu', - 'route' => 'admin.other-content.socialArticles.index', + 'module' => true, 'primary_navigation' => [ 'socialArticles' => [ 'title' => 'Articles réseaux sociaux', diff --git a/database/migrations/2020_08_15_083028_change_podcasts_table.php b/database/migrations/2020_08_15_083028_change_podcasts_table.php new file mode 100644 index 0000000..fc06d22 --- /dev/null +++ b/database/migrations/2020_08_15_083028_change_podcasts_table.php @@ -0,0 +1,45 @@ +text('coup_de_coeur_text'); + $table->string('coup_de_coeur_link')->nullable(); + $table->text('coup_de_com_text'); + $table->string('coup_de_com_link')->nullable(); + $table->text('journal_com_text'); + $table->string('journal_com_link')->nullable(); + + + }); + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('podcasts', function (Blueprint $table) { + $table->dropColumn('coup_de_coeur_text'); + $table->dropColumn('coup_de_coeur_link'); + $table->dropColumn('coup_de_com_text'); + $table->dropColumn('coup_de_com_link'); + $table->dropColumn('journal_com_text'); + $table->dropColumn('journal_com_link'); + }); + } +} diff --git a/public/css/app.css b/public/css/app.css index 9b1186a..f9179c4 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -11573,7 +11573,6 @@ article .content { max-width: 800px; font-size: larger; margin: auto; - text-align: justify; } article img.top-img { diff --git a/resources/sass/app.scss b/resources/sass/app.scss index a2e1806..b0afce1 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -114,7 +114,6 @@ article { max-width: 800px; font-size: larger; margin: auto; - text-align: justify; } img.top-img { diff --git a/resources/views/admin/blocks/image.blade.php b/resources/views/admin/blocks/image.blade.php index f5d5336..37df23d 100644 --- a/resources/views/admin/blocks/image.blade.php +++ b/resources/views/admin/blocks/image.blade.php @@ -6,3 +6,8 @@ 'translated' => false, ]) +@formField('input', [ + 'name' => 'link', + 'label' => 'Lien (facultatif)', + 'hint' => 'https://', +]) diff --git a/resources/views/admin/podcasts/form.blade.php b/resources/views/admin/podcasts/form.blade.php index d09e6c0..82f624c 100644 --- a/resources/views/admin/podcasts/form.blade.php +++ b/resources/views/admin/podcasts/form.blade.php @@ -8,6 +8,11 @@ 'fieldset' => 'sponsor', 'label' => 'Partenaire', ], + [ + 'fieldset' => 'segments', + 'label' => 'Segments', + + ], [ 'fieldset' => 'file', 'label' => 'Fichier', @@ -54,6 +59,67 @@ @endcomponent + @component('twill::partials.form.utils._fieldset', ['id' => 'segments', 'title' => 'Coups de coeur et com']) + + @formField('wysiwyg', [ + 'label' => 'Le coup de coeur', + 'name' => 'coup_de_coeur_text', + 'maxlength' => 250, + 'required' => true, + ]) + @formField('input', [ + 'label' => 'Lien le coup de coeur', + 'name' => 'coup_de_coeur_link', + 'maxlength' => 250, + ]) + + @formField('medias', [ + 'name' => 'coup_de_coeur_img', + 'label' => 'Logo coup de coeur', + 'max' => 1, + + ]) + + @formField('wysiwyg', [ + 'label' => 'Le coup de com', + 'name' => 'coup_de_com_text', + 'maxlength' => 250, + 'required' => true, + ]) + @formField('input', [ + 'label' => 'Lien le coup de com', + 'name' => 'coup_de_com_link', + 'maxlength' => 250, + ]) + + @formField('medias', [ + 'name' => 'coup_de_com_img', + 'label' => 'Logo coup de com', + 'max' => 1, + + ]) + @formField('wysiwyg', [ + 'label' => 'Le journal de la com santé', + 'name' => 'journal_com_text', + 'maxlength' => 450, + 'required' => true, + ]) + @formField('input', [ + 'label' => 'Lien le journal de la com santé', + 'name' => 'journal_com_link', + 'maxlength' => 250, + ]) + + @formField('medias', [ + 'name' => 'journal_com_img', + 'label' => 'Image journal de la com santé', + 'max' => 1, + + ]) + + + @endcomponent + @component('twill::partials.form.utils._fieldset', ['id' => 'file', 'title' => 'Fichier audio']) @formField('files', [ diff --git a/resources/views/admin/settings/podcasts.blade.php b/resources/views/admin/settings/podcasts.blade.php deleted file mode 100644 index 6d7c16d..0000000 --- a/resources/views/admin/settings/podcasts.blade.php +++ /dev/null @@ -1,64 +0,0 @@ -@extends('twill::layouts.settings', ['contentFieldsetLabel' => 'Modification de la page podcatss']) - -@section('contentFields') - @formField('wysiwyg', [ - 'label' => 'Le coup de coeur', - 'name' => 'coup_de_coeur_text', - 'maxlength' => 250, - 'required' => true, - ]) - @formField('input', [ - 'label' => 'Lien le coup de coeur', - 'name' => 'coup_de_coeur_link', - 'maxlength' => 250, - ]) - - @formField('medias', [ - 'name' => 'coup_de_coeur_img', - 'label' => 'Logo coup de coeur', - 'max' => 1, - - ]) - - - - @formField('wysiwyg', [ - 'label' => 'Le coup de com', - 'name' => 'coup_de_com_text', - 'maxlength' => 250, - 'required' => true, - ]) - @formField('input', [ - 'label' => 'Lien le coup de com', - 'name' => 'coup_de_com_link', - 'maxlength' => 250, - ]) - - @formField('medias', [ - 'name' => 'coup_de_com_img', - 'label' => 'Logo coup de com', - 'max' => 1, - - ]) - @formField('wysiwyg', [ - 'label' => 'Le journal de la com santé', - 'name' => 'journal_com_text', - 'maxlength' => 450, - 'required' => true, - ]) - @formField('input', [ - 'label' => 'Lien le journal de la com santé', - 'name' => 'journal_com_link', - 'maxlength' => 250, - ]) - - @formField('medias', [ - 'name' => 'journal_com_img', - 'label' => 'Image journal de la com santé', - 'max' => 1, - - ]) - - - -@stop diff --git a/resources/views/podcasts/index.blade.php b/resources/views/podcasts/show.blade.php similarity index 83% rename from resources/views/podcasts/index.blade.php rename to resources/views/podcasts/show.blade.php index ca2768a..9bec90f 100644 --- a/resources/views/podcasts/index.blade.php +++ b/resources/views/podcasts/show.blade.php @@ -70,11 +70,11 @@

Le coup de cœur

- {!! $settings->byKey('coup_de_coeur_text') !!} + {!! $podcast->coup_de_coeur_text !!}
- - Logo coup de coeur + + Logo coup de coeur

Cliquez sur le logo pour accéder au site de notre partenaire

@@ -87,11 +87,11 @@

Le coup de com

- {!! $settings->byKey('coup_de_com_text') !!} + {!! $podcast->coup_de_com_text !!}
- - Logo coup de com + + Logo coup de com

Cliquez sur le logo pour accéder au site de notre partenaire

@@ -107,11 +107,11 @@

Le journal de la com santé

- {!! $settings->byKey('journal_com_text') !!} + {!! $podcast->journal_com_text !!}
- - Image coup de com santé + + Image coup de com santé

Cliquez sur la une de la semaine pour accéder

diff --git a/resources/views/site/blocks/image.blade.php b/resources/views/site/blocks/image.blade.php index 2fab201..45ee488 100644 --- a/resources/views/site/blocks/image.blade.php +++ b/resources/views/site/blocks/image.blade.php @@ -1 +1,10 @@ +@php +$link = $block->input('link'); +@endphp +@if(!empty($link)) + +@endif +@if(!empty($link)) + +@endif diff --git a/routes/admin.php b/routes/admin.php index 9c31dea..53e3dbe 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -18,7 +18,7 @@ Route::prefix('settings')->group(function() { Route::module('pillBoxSpaces'); }); -Route::prefix('other-content')->group(function () { +Route::prefix('otherContent')->group(function () { Route::module('socialArticles'); }); -- 2.39.5