From 2663cf3d97b0141f3a122a5a059da0d9434e77c5 Mon Sep 17 00:00:00 2001 From: Louis Jeckel Date: Wed, 2 Sep 2020 19:40:32 +0200 Subject: [PATCH] add humeurs and agenda, remove article --- ...cleController.php => HumeurController.php} | 4 +- .../Admin/WeeklyAgendaController.php | 26 +++++++ .../{ArticleRequest.php => HumeurRequest.php} | 2 +- .../Requests/Admin/WeeklyAgendaRequest.php | 18 +++++ app/Models/Article.php | 61 ---------------- app/Models/Humeur.php | 24 +++++++ app/Models/Revisions/ArticleRevision.php | 10 --- app/Models/Slugs/ArticleSlug.php | 10 --- app/Models/Slugs/HumeurSlug.php | 10 +++ app/Models/WeeklyAgenda.php | 38 ++++++++++ app/Repositories/ArticleRepository.php | 21 ------ app/Repositories/HumeurRepository.php | 17 +++++ app/Repositories/WeeklyAgendaRepository.php | 18 +++++ config/twill-navigation.php | 69 +++++++++++-------- config/twill.php | 14 +--- ...2020_09_02_152540_drop_articles_tables.php | 30 ++++++++ ...020_09_02_153138_create_humeurs_tables.php | 39 +++++++++++ ...02_153336_create_weekly_agendas_tables.php | 35 ++++++++++ .../views/admin/eventImages/form.blade.php | 9 +++ resources/views/admin/humeurs/form.blade.php | 15 ++++ .../admin/weeklyAgendas/create.blade.php | 6 ++ .../views/admin/weeklyAgendas/form.blade.php | 13 ++++ .../views/agenda-humeurs/index.blade.php | 0 routes/admin.php | 4 ++ 24 files changed, 348 insertions(+), 145 deletions(-) rename app/Http/Controllers/Admin/{ArticleController.php => HumeurController.php} (54%) create mode 100644 app/Http/Controllers/Admin/WeeklyAgendaController.php rename app/Http/Requests/Admin/{ArticleRequest.php => HumeurRequest.php} (86%) create mode 100644 app/Http/Requests/Admin/WeeklyAgendaRequest.php delete mode 100644 app/Models/Article.php create mode 100644 app/Models/Humeur.php delete mode 100644 app/Models/Revisions/ArticleRevision.php delete mode 100644 app/Models/Slugs/ArticleSlug.php create mode 100644 app/Models/Slugs/HumeurSlug.php create mode 100644 app/Models/WeeklyAgenda.php delete mode 100644 app/Repositories/ArticleRepository.php create mode 100644 app/Repositories/HumeurRepository.php create mode 100644 app/Repositories/WeeklyAgendaRepository.php create mode 100644 database/migrations/2020_09_02_152540_drop_articles_tables.php create mode 100644 database/migrations/2020_09_02_153138_create_humeurs_tables.php create mode 100644 database/migrations/2020_09_02_153336_create_weekly_agendas_tables.php create mode 100644 resources/views/admin/eventImages/form.blade.php create mode 100644 resources/views/admin/humeurs/form.blade.php create mode 100644 resources/views/admin/weeklyAgendas/create.blade.php create mode 100644 resources/views/admin/weeklyAgendas/form.blade.php create mode 100644 resources/views/agenda-humeurs/index.blade.php diff --git a/app/Http/Controllers/Admin/ArticleController.php b/app/Http/Controllers/Admin/HumeurController.php similarity index 54% rename from app/Http/Controllers/Admin/ArticleController.php rename to app/Http/Controllers/Admin/HumeurController.php index deefff9..ec4e514 100644 --- a/app/Http/Controllers/Admin/ArticleController.php +++ b/app/Http/Controllers/Admin/HumeurController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Admin; use A17\Twill\Http\Controllers\Admin\ModuleController; -class ArticleController extends ModuleController +class HumeurController extends ModuleController { - protected $moduleName = 'articles'; + protected $moduleName = 'humeurs'; } diff --git a/app/Http/Controllers/Admin/WeeklyAgendaController.php b/app/Http/Controllers/Admin/WeeklyAgendaController.php new file mode 100644 index 0000000..b6e155e --- /dev/null +++ b/app/Http/Controllers/Admin/WeeklyAgendaController.php @@ -0,0 +1,26 @@ + false, + 'bulkPublish' => false, + ]; + + protected $indexColumns = [ + 'start_date' => [ + 'title' => 'Date de début', + 'field' => 'start_date', + 'sort' => true, + ], + + ]; +} diff --git a/app/Http/Requests/Admin/ArticleRequest.php b/app/Http/Requests/Admin/HumeurRequest.php similarity index 86% rename from app/Http/Requests/Admin/ArticleRequest.php rename to app/Http/Requests/Admin/HumeurRequest.php index 14396e7..3f5f462 100644 --- a/app/Http/Requests/Admin/ArticleRequest.php +++ b/app/Http/Requests/Admin/HumeurRequest.php @@ -4,7 +4,7 @@ namespace App\Http\Requests\Admin; use A17\Twill\Http\Requests\Admin\Request; -class ArticleRequest extends Request +class HumeurRequest extends Request { public function rulesForCreate() { diff --git a/app/Http/Requests/Admin/WeeklyAgendaRequest.php b/app/Http/Requests/Admin/WeeklyAgendaRequest.php new file mode 100644 index 0000000..566b552 --- /dev/null +++ b/app/Http/Requests/Admin/WeeklyAgendaRequest.php @@ -0,0 +1,18 @@ + [ - 'desktop' => [ - [ - 'name' => 'desktop', - '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/app/Models/Humeur.php b/app/Models/Humeur.php new file mode 100644 index 0000000..acb9dc4 --- /dev/null +++ b/app/Models/Humeur.php @@ -0,0 +1,24 @@ + [ + 'default' => [ + [ + 'name' => 'default', + 'ratio' => 0, + ], + ], + ], + ]; + + public function getTitleAttribute() + { + return $this->start_date; + } + + +} + diff --git a/app/Repositories/ArticleRepository.php b/app/Repositories/ArticleRepository.php deleted file mode 100644 index 7c8afc7..0000000 --- a/app/Repositories/ArticleRepository.php +++ /dev/null @@ -1,21 +0,0 @@ -model = $model; - } -} diff --git a/app/Repositories/HumeurRepository.php b/app/Repositories/HumeurRepository.php new file mode 100644 index 0000000..20cd175 --- /dev/null +++ b/app/Repositories/HumeurRepository.php @@ -0,0 +1,17 @@ +model = $model; + } +} diff --git a/app/Repositories/WeeklyAgendaRepository.php b/app/Repositories/WeeklyAgendaRepository.php new file mode 100644 index 0000000..53f6500 --- /dev/null +++ b/app/Repositories/WeeklyAgendaRepository.php @@ -0,0 +1,18 @@ +model = $model; + } +} diff --git a/config/twill-navigation.php b/config/twill-navigation.php index a9060b2..5cced51 100644 --- a/config/twill-navigation.php +++ b/config/twill-navigation.php @@ -24,38 +24,49 @@ return [ ], 'content' => [ 'title' => 'Contenu du site', - 'route' => 'admin.content.homepage', + 'route' => 'pdfFiles.index', + 'module' => true, 'primary_navigation' => [ - 'homepage' => [ - 'title' => "Page d'accueil", - 'route' => 'admin.content.homepage', - ], - 'pdfFiles' => [ - 'title' => 'Lettres', - 'module' => true - ], - - 'adCampaigns' => [ - 'title' => 'Campagnes publicitaires', - 'module' => true - ], - 'laboArticles' => [ - 'title' => 'Actu des labos', - 'module' => true - ], +// 'homepage' => [ +// 'title' => "Page d'accueil", +// 'route' => 'admin.content.homepage', +// ], + 'pdfFiles' => [ + 'title' => 'Lettres', + 'module' => true + ], + + 'adCampaigns' => [ + 'title' => 'Campagnes publicitaires', + 'module' => true + ], + 'laboArticles' => [ + 'title' => 'Actu des labos', + 'module' => true + ], + 'humeurs' => [ + 'title' => 'Humeurs', + 'module' => true + ], + 'weeklyAgendas' => [ + 'title' => 'Agenda', + 'module' => true + ], + + // 'events' => [ // 'title' => 'Evénements', // 'module' => true // ], - 'articles' => [ - 'title' => 'Humeurs', - 'module' => true - ], - 'podcasts' => [ - 'title' => 'Podcasts', - 'module' => true - ], +// 'articles' => [ +// 'title' => 'Humeurs', +// 'module' => true +// ], + 'podcasts' => [ + 'title' => 'Podcasts', + 'module' => true + ], ], ], @@ -71,9 +82,9 @@ return [ ], 'pillBoxSpaces' => [ - 'title' => 'Emplacement encadrés', - 'module' => true - ] + 'title' => 'Emplacement encadrés', + 'module' => true + ] ] ], 'otherContent' => [ diff --git a/config/twill.php b/config/twill.php index 925fd15..b7640a3 100644 --- a/config/twill.php +++ b/config/twill.php @@ -67,17 +67,6 @@ return [ ], 'max_items' => 4, ], - 'bloc_articles' => [ - 'name' => 'News de la semaine', - 'bucketables' => [ - [ - 'module' => 'articles', - 'name' => 'Articles', - 'scopes' => ['published' => true], - ], - ], - 'max_items' => 4, - ], 'events' => [ 'name' => 'Evénement mis en avant', 'bucketables' => [ @@ -260,6 +249,9 @@ return [ 'media_library' => [ 'image_service' => \A17\Twill\Services\MediaLibrary\Glide::class, + 'extra_metadatas_fields' => [ + ['name' => 'url', 'label' => 'Lien', 'type' => 'input'], + ], ], 'block_editor' => [ 'block_single_layout' => 'site.layouts.block', // layout to use when rendering a single block in the editor diff --git a/database/migrations/2020_09_02_152540_drop_articles_tables.php b/database/migrations/2020_09_02_152540_drop_articles_tables.php new file mode 100644 index 0000000..0f2ed67 --- /dev/null +++ b/database/migrations/2020_09_02_152540_drop_articles_tables.php @@ -0,0 +1,30 @@ +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('extract')->nullable(); + $table->text('content')->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(); + }); + + Schema::create('humeur_slugs', function (Blueprint $table) { + createDefaultSlugsTableFields($table, 'humeur'); + }); + + + } + + public function down() + { + + Schema::dropIfExists('humeur_slugs'); + Schema::dropIfExists('humeurs'); + } +} diff --git a/database/migrations/2020_09_02_153336_create_weekly_agendas_tables.php b/database/migrations/2020_09_02_153336_create_weekly_agendas_tables.php new file mode 100644 index 0000000..b2ed1b0 --- /dev/null +++ b/database/migrations/2020_09_02_153336_create_weekly_agendas_tables.php @@ -0,0 +1,35 @@ +date('start_date')->nullable(); +// $table->string('title')->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(); + }); + + + + + + + } + + public function down() + { + + Schema::dropIfExists('weekly_agendas'); + } +} diff --git a/resources/views/admin/eventImages/form.blade.php b/resources/views/admin/eventImages/form.blade.php new file mode 100644 index 0000000..2a22637 --- /dev/null +++ b/resources/views/admin/eventImages/form.blade.php @@ -0,0 +1,9 @@ +@extends('twill::layouts.form') + +@section('contentFields') + @formField('input', [ + 'name' => 'description', + 'label' => 'Description', + 'maxlength' => 100 + ]) +@stop diff --git a/resources/views/admin/humeurs/form.blade.php b/resources/views/admin/humeurs/form.blade.php new file mode 100644 index 0000000..e50290c --- /dev/null +++ b/resources/views/admin/humeurs/form.blade.php @@ -0,0 +1,15 @@ +@extends('twill::layouts.form') + +@section('contentFields') + @formField('wysiwyg', [ + 'name' => 'extract', + 'label' => 'Extrait', + 'maxlength' => 250 + ]) + + @formField('wysiwyg', [ + 'name' => 'content', + 'label' => 'Article complet', + ]) +@stop + diff --git a/resources/views/admin/weeklyAgendas/create.blade.php b/resources/views/admin/weeklyAgendas/create.blade.php new file mode 100644 index 0000000..d9632d0 --- /dev/null +++ b/resources/views/admin/weeklyAgendas/create.blade.php @@ -0,0 +1,6 @@ +@formField('date_picker', [ + 'name' => 'start_date', + 'label' => 'Date de la semaine (au lundi)', + 'withTime' => false, + 'altFormat' => 'j F Y' +]) diff --git a/resources/views/admin/weeklyAgendas/form.blade.php b/resources/views/admin/weeklyAgendas/form.blade.php new file mode 100644 index 0000000..7da28af --- /dev/null +++ b/resources/views/admin/weeklyAgendas/form.blade.php @@ -0,0 +1,13 @@ +@extends('twill::layouts.form') + +@section('contentFields') + @formField('medias', [ + 'name' => 'events', + 'label' => 'Evénements', + 'withVideoUrl' => false, + 'withCaption' => false, + 'withAddinfo' => false, + 'extraMetadatas' => [['name' => 'url', 'label' => 'URL']], + 'max' => 50, + ]) +@stop diff --git a/resources/views/agenda-humeurs/index.blade.php b/resources/views/agenda-humeurs/index.blade.php new file mode 100644 index 0000000..e69de29 diff --git a/routes/admin.php b/routes/admin.php index d1d865c..d089758 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -11,7 +11,11 @@ Route::prefix('content')->group(function() { Route::module('events'); Route::module('podcasts'); Route::module('laboArticles'); + Route::module('weeklyAgendas'); + Route::module('eventImages'); + Route::module('humeurs'); Route::module('guests'); //podcast guests + }); Route::prefix('settings')->group(function() { -- 2.39.5