]> _ Git - psq.git/commitdiff
add humeurs and agenda, remove article
authorLouis Jeckel <louis.jeckel@outlook.cm>
Wed, 2 Sep 2020 17:40:32 +0000 (19:40 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Wed, 2 Sep 2020 17:40:32 +0000 (19:40 +0200)
26 files changed:
app/Http/Controllers/Admin/ArticleController.php [deleted file]
app/Http/Controllers/Admin/HumeurController.php [new file with mode: 0644]
app/Http/Controllers/Admin/WeeklyAgendaController.php [new file with mode: 0644]
app/Http/Requests/Admin/ArticleRequest.php [deleted file]
app/Http/Requests/Admin/HumeurRequest.php [new file with mode: 0644]
app/Http/Requests/Admin/WeeklyAgendaRequest.php [new file with mode: 0644]
app/Models/Article.php [deleted file]
app/Models/Humeur.php [new file with mode: 0644]
app/Models/Revisions/ArticleRevision.php [deleted file]
app/Models/Slugs/ArticleSlug.php [deleted file]
app/Models/Slugs/HumeurSlug.php [new file with mode: 0644]
app/Models/WeeklyAgenda.php [new file with mode: 0644]
app/Repositories/ArticleRepository.php [deleted file]
app/Repositories/HumeurRepository.php [new file with mode: 0644]
app/Repositories/WeeklyAgendaRepository.php [new file with mode: 0644]
config/twill-navigation.php
config/twill.php
database/migrations/2020_09_02_152540_drop_articles_tables.php [new file with mode: 0644]
database/migrations/2020_09_02_153138_create_humeurs_tables.php [new file with mode: 0644]
database/migrations/2020_09_02_153336_create_weekly_agendas_tables.php [new file with mode: 0644]
resources/views/admin/eventImages/form.blade.php [new file with mode: 0644]
resources/views/admin/humeurs/form.blade.php [new file with mode: 0644]
resources/views/admin/weeklyAgendas/create.blade.php [new file with mode: 0644]
resources/views/admin/weeklyAgendas/form.blade.php [new file with mode: 0644]
resources/views/agenda-humeurs/index.blade.php [new file with mode: 0644]
routes/admin.php

diff --git a/app/Http/Controllers/Admin/ArticleController.php b/app/Http/Controllers/Admin/ArticleController.php
deleted file mode 100644 (file)
index deefff9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-namespace App\Http\Controllers\Admin;
-
-use A17\Twill\Http\Controllers\Admin\ModuleController;
-
-class ArticleController extends ModuleController
-{
-    protected $moduleName = 'articles';
-}
diff --git a/app/Http/Controllers/Admin/HumeurController.php b/app/Http/Controllers/Admin/HumeurController.php
new file mode 100644 (file)
index 0000000..ec4e514
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use A17\Twill\Http\Controllers\Admin\ModuleController;
+
+class HumeurController extends ModuleController
+{
+    protected $moduleName = 'humeurs';
+}
diff --git a/app/Http/Controllers/Admin/WeeklyAgendaController.php b/app/Http/Controllers/Admin/WeeklyAgendaController.php
new file mode 100644 (file)
index 0000000..b6e155e
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use A17\Twill\Http\Controllers\Admin\ModuleController;
+
+class WeeklyAgendaController extends ModuleController
+{
+    protected $moduleName = 'weeklyAgendas';
+
+    protected $titleColumnKey = "start_date";
+
+    protected $indexOptions = [
+        'publish' => 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/ArticleRequest.php
deleted file mode 100644 (file)
index 14396e7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Http\Requests\Admin;
-
-use A17\Twill\Http\Requests\Admin\Request;
-
-class ArticleRequest extends Request
-{
-    public function rulesForCreate()
-    {
-        return [];
-    }
-
-    public function rulesForUpdate()
-    {
-        return [];
-    }
-}
diff --git a/app/Http/Requests/Admin/HumeurRequest.php b/app/Http/Requests/Admin/HumeurRequest.php
new file mode 100644 (file)
index 0000000..3f5f462
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Requests\Admin;
+
+use A17\Twill\Http\Requests\Admin\Request;
+
+class HumeurRequest extends Request
+{
+    public function rulesForCreate()
+    {
+        return [];
+    }
+
+    public function rulesForUpdate()
+    {
+        return [];
+    }
+}
diff --git a/app/Http/Requests/Admin/WeeklyAgendaRequest.php b/app/Http/Requests/Admin/WeeklyAgendaRequest.php
new file mode 100644 (file)
index 0000000..566b552
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Requests\Admin;
+
+use A17\Twill\Http\Requests\Admin\Request;
+
+class WeeklyAgendaRequest extends Request
+{
+    public function rulesForCreate()
+    {
+        return [];
+    }
+
+    public function rulesForUpdate()
+    {
+        return [];
+    }
+}
diff --git a/app/Models/Article.php b/app/Models/Article.php
deleted file mode 100644 (file)
index b7bdbad..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
-namespace App\Models;
-
-use A17\Twill\Models\Behaviors\HasBlocks;
-use A17\Twill\Models\Behaviors\HasSlug;
-use A17\Twill\Models\Behaviors\HasMedias;
-use A17\Twill\Models\Behaviors\HasRevisions;
-use A17\Twill\Models\Behaviors\HasPosition;
-use A17\Twill\Models\Behaviors\Sortable;
-use A17\Twill\Models\Model;
-
-class Article extends Model implements Sortable
-{
-    use HasBlocks, HasSlug, HasMedias, HasRevisions, HasPosition;
-
-    protected $fillable = [
-        'published',
-        'title',
-        'description',
-        'position',
-    ];
-
-    public $slugAttributes = [
-        'title',
-    ];
-
-    public $mediasParams = [
-        'cover' => [
-            '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 (file)
index 0000000..acb9dc4
--- /dev/null
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Models;
+
+use A17\Twill\Models\Behaviors\HasSlug;
+use A17\Twill\Models\Model;
+
+class Humeur extends Model
+{
+    use HasSlug;
+
+    protected $fillable = [
+        'published',
+        'title',
+        'content',
+        'extract',
+        'publish_start_date'
+    ];
+
+    public $slugAttributes = [
+        'title',
+    ];
+
+}
diff --git a/app/Models/Revisions/ArticleRevision.php b/app/Models/Revisions/ArticleRevision.php
deleted file mode 100644 (file)
index 92c8897..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-namespace App\Models\Revisions;
-
-use A17\Twill\Models\Revision;
-
-class ArticleRevision extends Revision
-{
-    protected $table = "article_revisions";
-}
diff --git a/app/Models/Slugs/ArticleSlug.php b/app/Models/Slugs/ArticleSlug.php
deleted file mode 100644 (file)
index 6fc022f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-namespace App\Models\Slugs;
-
-use A17\Twill\Models\Model;
-
-class ArticleSlug extends Model
-{
-    protected $table = "article_slugs";
-}
diff --git a/app/Models/Slugs/HumeurSlug.php b/app/Models/Slugs/HumeurSlug.php
new file mode 100644 (file)
index 0000000..86d982a
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models\Slugs;
+
+use A17\Twill\Models\Model;
+
+class HumeurSlug extends Model
+{
+    protected $table = "humeur_slugs";
+}
diff --git a/app/Models/WeeklyAgenda.php b/app/Models/WeeklyAgenda.php
new file mode 100644 (file)
index 0000000..c18a221
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+
+namespace App\Models;
+
+use A17\Twill\Models\Behaviors\HasBlocks;
+use A17\Twill\Models\Behaviors\HasMedias;
+use A17\Twill\Models\Model;
+
+class WeeklyAgenda extends Model
+{
+    use HasMedias;
+
+    protected $fillable = [
+        'start_date',
+        'title',
+    ];
+
+    protected $appends = ['title'];
+
+    public $mediasParams = [
+        'events' => [
+            '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 (file)
index 7c8afc7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-namespace App\Repositories;
-
-use A17\Twill\Repositories\Behaviors\HandleBlocks;
-use A17\Twill\Repositories\Behaviors\HandleSlugs;
-use A17\Twill\Repositories\Behaviors\HandleMedias;
-use A17\Twill\Repositories\Behaviors\HandleRevisions;
-use A17\Twill\Repositories\Behaviors\HandleTags;
-use A17\Twill\Repositories\ModuleRepository;
-use App\Models\Article;
-
-class ArticleRepository extends ModuleRepository
-{
-    use HandleBlocks, HandleSlugs, HandleMedias, HandleRevisions;
-
-    public function __construct(Article $model)
-    {
-        $this->model = $model;
-    }
-}
diff --git a/app/Repositories/HumeurRepository.php b/app/Repositories/HumeurRepository.php
new file mode 100644 (file)
index 0000000..20cd175
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Repositories;
+
+use A17\Twill\Repositories\Behaviors\HandleSlugs;
+use A17\Twill\Repositories\ModuleRepository;
+use App\Models\Humeur;
+
+class HumeurRepository extends ModuleRepository
+{
+    use HandleSlugs;
+
+    public function __construct(Humeur $model)
+    {
+        $this->model = $model;
+    }
+}
diff --git a/app/Repositories/WeeklyAgendaRepository.php b/app/Repositories/WeeklyAgendaRepository.php
new file mode 100644 (file)
index 0000000..53f6500
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Repositories;
+
+use A17\Twill\Repositories\Behaviors\HandleBlocks;
+use A17\Twill\Repositories\Behaviors\HandleMedias;
+use A17\Twill\Repositories\ModuleRepository;
+use App\Models\WeeklyAgenda;
+
+class WeeklyAgendaRepository extends ModuleRepository
+{
+    use HandleMedias;
+
+    public function __construct(WeeklyAgenda $model)
+    {
+        $this->model = $model;
+    }
+}
index a9060b2aea757fdf9f038a395f27ce131c08f234..5cced515763e6a0e14a1edc1b76efcbf3160f755 100644 (file)
@@ -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' => [
index 925fd1528ccdb2422e045b5ba92cbc888f14f9b4..b7640a3444dff9e7b3f53b065845a2e5c4cc4b96 100644 (file)
@@ -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 (file)
index 0000000..0f2ed67
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class DropArticlesTables extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        \Schema::dropIfExists('article_slugs');
+        \Schema::dropIfExists('article_revisions');
+        \Schema::dropIfExists('articles');
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+}
diff --git a/database/migrations/2020_09_02_153138_create_humeurs_tables.php b/database/migrations/2020_09_02_153138_create_humeurs_tables.php
new file mode 100644 (file)
index 0000000..eeef937
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+
+class CreateHumeursTables extends Migration
+{
+    public function up()
+    {
+        Schema::create('humeurs', function (Blueprint $table) {
+            // this will create an id, a "published" column, and soft delete and timestamps columns
+            createDefaultTableFields($table);
+
+            // feel free to modify the name of this column, but title is supported by default (you would need to specify the name of the column Twill should consider as your "title" column in your module controller if you change it)
+            $table->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 (file)
index 0000000..b2ed1b0
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+
+class CreateWeeklyAgendasTables extends Migration
+{
+    public function up()
+    {
+        Schema::create('weekly_agendas', function (Blueprint $table) {
+            // this will create an id, a "published" column, and soft delete and timestamps columns
+            createDefaultTableFields($table);
+
+            // feel free to modify the name of this column, but title is supported by default (you would need to specify the name of the column Twill should consider as your "title" column in your module controller if you change it)
+            $table->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 (file)
index 0000000..2a22637
--- /dev/null
@@ -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 (file)
index 0000000..e50290c
--- /dev/null
@@ -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 (file)
index 0000000..d9632d0
--- /dev/null
@@ -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 (file)
index 0000000..7da28af
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
index d1d865caa8811a2194d6a84249289a8df4199f89..d08975829b12a3afd0de2b327668a5e9efb76b54 100644 (file)
@@ -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() {