]> _ Git - psq.git/commitdiff
try json repeater
authorLouis Jeckel <louis.jeckel@outlook.cm>
Tue, 4 Aug 2020 12:45:14 +0000 (14:45 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Tue, 4 Aug 2020 12:45:14 +0000 (14:45 +0200)
16 files changed:
.idea/blade.xml [new file with mode: 0644]
.idea/dictionaries/Louis.xml
app/Http/Controllers/Admin/PodcastController.php [new file with mode: 0644]
app/Http/Requests/Admin/PodcastRequest.php [new file with mode: 0644]
app/Models/Podcast.php [new file with mode: 0644]
app/Models/Slugs/PodcastSlug.php [new file with mode: 0644]
app/Repositories/PodcastRepository.php [new file with mode: 0644]
composer.lock
config/twill-navigation.php
config/twill.php
database/migrations/2020_08_04_093907_create_podcasts_tables.php [new file with mode: 0644]
resources/views/admin/adCampaigns/form.blade.php
resources/views/admin/blocks/guests.blade.php [new file with mode: 0644]
resources/views/admin/podcasts/form.blade.php [new file with mode: 0644]
resources/views/components/nav.blade.php
routes/admin.php

diff --git a/.idea/blade.xml b/.idea/blade.xml
new file mode 100644 (file)
index 0000000..cc88888
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="BladeInjectionConfiguration" default="false">
+    <directives>
+      <data directive="@append" />
+      <data directive="@auth" injection="true" prefix="&lt;?php if(auth()-&gt;guard(" suffix=")-&gt;check()): ?&gt;" />
+      <data directive="@break" injection="true" prefix="&lt;?php if(" suffix=") break; ?&gt;" />
+      <data directive="@can" injection="true" prefix="&lt;?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)-&gt;check(" suffix=")): ?&gt;" />
+      <data directive="@canany" injection="true" prefix="&lt;?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)-&gt;any(" suffix=")): ?&gt;" />
+      <data directive="@cannot" injection="true" prefix="&lt;?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)-&gt;denies(" suffix=")): ?&gt;" />
+      <data directive="@case" injection="true" prefix="&lt;?php case (" suffix="): ?&gt;" />
+      <data directive="@choice" injection="true" prefix="&lt;?php echo app('translator')-&gt;choice(" suffix="); ?&gt;" />
+      <data directive="@component" injection="true" prefix="&lt;?php $__env-&gt;startComponent(" suffix="); ?&gt;" />
+      <data directive="@componentfirst" injection="true" prefix="&lt;?php $__env-&gt;startComponentFirst(" suffix="); ?&gt;" />
+      <data directive="@continue" injection="true" prefix="&lt;?php if(" suffix=") continue; ?&gt;" />
+      <data directive="@csrf" />
+      <data directive="@dd" injection="true" prefix="&lt;?php dd(" suffix="); ?&gt;" />
+      <data directive="@default" />
+      <data directive="@dump" injection="true" prefix="&lt;?php dump(" suffix="); ?&gt;" />
+      <data directive="@each" injection="true" prefix="&lt;?php echo $__env-&gt;renderEach(" suffix="); ?&gt;" />
+      <data directive="@else" />
+      <data directive="@elseauth" injection="true" prefix="&lt;?php elseif(auth()-&gt;guard(" suffix=")-&gt;check()): ?&gt;" />
+      <data directive="@elsecan" injection="true" prefix="&lt;?php elseif (app(\Illuminate\Contracts\Auth\Access\Gate::class)-&gt;check(" suffix=")): ?&gt;" />
+      <data directive="@elsecanany" injection="true" prefix="&lt;?php elseif (app(\Illuminate\Contracts\Auth\Access\Gate::class)-&gt;any(" suffix=")): ?&gt;" />
+      <data directive="@elsecannot" injection="true" prefix="&lt;?php elseif (app(\Illuminate\Contracts\Auth\Access\Gate::class)-&gt;denies(" suffix=")): ?&gt;" />
+      <data directive="@elseguest" injection="true" prefix="&lt;?php elseif(auth()-&gt;guard(" suffix=")-&gt;guest()): ?&gt;" />
+      <data directive="@elseif" injection="true" prefix="&lt;?php elseif(" suffix="): ?&gt;" />
+      <data directive="@empty" injection="true" prefix="&lt;?php if(empty(" suffix=")): ?&gt;" />
+      <data directive="@endauth" />
+      <data directive="@endcan" />
+      <data directive="@endcanany" />
+      <data directive="@endcannot" />
+      <data directive="@endcomponent" />
+      <data directive="@endcomponentClass" />
+      <data directive="@endcomponentfirst" />
+      <data directive="@endempty" />
+      <data directive="@enderror" />
+      <data directive="@endfor" />
+      <data directive="@endforeach" />
+      <data directive="@endforelse" />
+      <data directive="@endguest" />
+      <data directive="@endif" />
+      <data directive="@endisset" />
+      <data directive="@endlang" />
+      <data directive="@endphp" />
+      <data directive="@endprepend" />
+      <data directive="@endpush" />
+      <data directive="@endsection" />
+      <data directive="@endslot" />
+      <data directive="@endswitch" />
+      <data directive="@endunless" />
+      <data directive="@endverbatim" />
+      <data directive="@endwhile" />
+      <data directive="@error" injection="true" prefix="&lt;?php $__errorArgs = [" suffix="];&#10;$__bag = $errors-&gt;getBag($__errorArgs[1] ?? 'default');&#10;if ($__bag-&gt;has($__errorArgs[0])) :&#10;if (isset($message)) { $__messageOriginal = $message; }&#10;$message = $__bag-&gt;first($__errorArgs[0]); ?&gt;" />
+      <data directive="@extends" injection="true" prefix="&lt;?php echo $__env-&gt;make(" suffix=", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))-&gt;render(); ?&gt;" />
+      <data directive="@for" injection="true" prefix="&lt;?php for(" suffix="): ?&gt;" />
+      <data directive="@foreach" injection="true" prefix="&lt;?php foreach(" suffix="): ?&gt;" />
+      <data directive="@forelse" injection="true" prefix="&lt;?php foreach(" suffix="): ?&gt;" />
+      <data directive="@formField" injection="true" prefix="&lt;?php dd(" suffix=")?&gt;" />
+      <data directive="@guest" injection="true" prefix="&lt;?php if(auth()-&gt;guard(" suffix=")-&gt;guest()): ?&gt;" />
+      <data directive="@hasSection" injection="true" prefix="&lt;?php if (! empty(trim($__env-&gt;yieldContent(" suffix=")))): ?&gt;" />
+      <data directive="@if" injection="true" prefix="&lt;?php if(" suffix="): ?&gt;" />
+      <data directive="@include" injection="true" prefix="&lt;?php echo $__env-&gt;make(" suffix=", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))-&gt;render(); ?&gt;" />
+      <data directive="@includeFirst" injection="true" prefix="&lt;?php echo $__env-&gt;first(" suffix=", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))-&gt;render(); ?&gt;" />
+      <data directive="@includeUnless" injection="true" prefix="&lt;?php echo $__env-&gt;renderWhen(! " suffix=", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path'])); ?&gt;" />
+      <data directive="@includeWhen" injection="true" prefix="&lt;?php echo $__env-&gt;renderWhen(" suffix=", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path'])); ?&gt;" />
+      <data directive="@isset" injection="true" prefix="&lt;?php if(isset(" suffix=")): ?&gt;" />
+      <data directive="@json" injection="true" prefix="&lt;?php echo json_encode(" suffix=") ?&gt;" />
+      <data directive="@lang" injection="true" prefix="&lt;?php echo app('translator')-&gt;get(" suffix="); ?&gt;" />
+      <data directive="@method" injection="true" prefix="&lt;?php echo method_field(" suffix="); ?&gt;" />
+      <data directive="@overwrite" />
+      <data directive="@parent" />
+      <data directive="@php" injection="true" prefix="&lt;?php (" suffix="); ?&gt;" />
+      <data directive="@prepend" injection="true" prefix="&lt;?php $__env-&gt;startPrepend(" suffix="); ?&gt;" />
+      <data directive="@push" injection="true" prefix="&lt;?php $__env-&gt;startPush(" suffix="); ?&gt;" />
+      <data directive="@section" injection="true" prefix="&lt;?php $__env-&gt;startSection(" suffix="); ?&gt;" />
+      <data directive="@show" />
+      <data directive="@slot" injection="true" prefix="&lt;?php $__env-&gt;slot(" suffix="); ?&gt;" />
+      <data directive="@stack" injection="true" prefix="&lt;?php echo $__env-&gt;yieldPushContent(" suffix="); ?&gt;" />
+      <data directive="@stop" />
+      <data directive="@switch" injection="true" prefix="&lt;?php switch(" suffix="): ?&gt;" />
+      <data directive="@unless" injection="true" prefix="&lt;?php if (! (" suffix=")): ?&gt;" />
+      <data directive="@unset" injection="true" prefix="&lt;?php unset(" suffix="); ?&gt;" />
+      <data directive="@verbatim" />
+      <data directive="@while" injection="true" prefix="&lt;?php while(" suffix="): ?&gt;" />
+      <data directive="@yield" injection="true" prefix="&lt;?php echo $__env-&gt;yieldContent(" suffix="); ?&gt;" />
+    </directives>
+  </component>
+</project>
\ No newline at end of file
index 2a6c35a2e9a6462f67e42cfb173b77033b6d55f7..24e8316fa977ce093d0360f6508c95c340d551d8 100644 (file)
@@ -2,6 +2,7 @@
   <dictionary name="Louis">
     <words>
       <w>mailgun</w>
+      <w>podcast</w>
       <w>webhook</w>
       <w>webhooks</w>
     </words>
diff --git a/app/Http/Controllers/Admin/PodcastController.php b/app/Http/Controllers/Admin/PodcastController.php
new file mode 100644 (file)
index 0000000..c1ed748
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use A17\Twill\Http\Controllers\Admin\ModuleController;
+
+class PodcastController extends ModuleController
+{
+    protected $moduleName = 'podcasts';
+}
diff --git a/app/Http/Requests/Admin/PodcastRequest.php b/app/Http/Requests/Admin/PodcastRequest.php
new file mode 100644 (file)
index 0000000..ba01f66
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Requests\Admin;
+
+use A17\Twill\Http\Requests\Admin\Request;
+
+class PodcastRequest extends Request
+{
+    public function rulesForCreate()
+    {
+        return [];
+    }
+
+    public function rulesForUpdate()
+    {
+        return [];
+    }
+}
diff --git a/app/Models/Podcast.php b/app/Models/Podcast.php
new file mode 100644 (file)
index 0000000..2cfc0a6
--- /dev/null
@@ -0,0 +1,43 @@
+<?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\HasFiles;
+use A17\Twill\Models\Model;
+
+class Podcast extends Model
+{
+    use HasSlug, HasMedias, HasFiles, HasBlocks;
+
+    protected $fillable = [
+        'published',
+        'title',
+        'description',
+        'sponsor',
+        'sponsor_url',
+        'publish_start_date',
+        'guests'
+    ];
+
+    protected $casts = [
+        'guests' => '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 (file)
index 0000000..8224f9a
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models\Slugs;
+
+use A17\Twill\Models\Model;
+
+class PodcastSlug extends Model
+{
+    protected $table = "podcast_slugs";
+}
diff --git a/app/Repositories/PodcastRepository.php b/app/Repositories/PodcastRepository.php
new file mode 100644 (file)
index 0000000..4574eff
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Repositories;
+
+use A17\Twill\Repositories\Behaviors\HandleBlocks;
+use A17\Twill\Repositories\Behaviors\HandleJsonRepeaters;
+use A17\Twill\Repositories\Behaviors\HandleSlugs;
+use A17\Twill\Repositories\Behaviors\HandleMedias;
+use A17\Twill\Repositories\Behaviors\HandleFiles;
+use A17\Twill\Repositories\ModuleRepository;
+use App\Models\Podcast;
+
+class PodcastRepository extends ModuleRepository
+{
+    use HandleSlugs, HandleMedias, HandleFiles, HandleBlocks, HandleJsonRepeaters;
+
+    protected array $jsonRepeaters = ['guests'];
+
+    public function __construct(Podcast $model)
+    {
+        $this->model = $model;
+    }
+}
index e07c5d01b443c255affc4a4e9769dcda96913fd7..3b5ee1f9933ff9afc50a94a903b4b8e2867a8ad3 100644 (file)
         },
         {
             "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": {
             "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": {
                 "laravel",
                 "twill"
             ],
-            "time": "2020-03-10T13:05:42+00:00"
+            "time": "2020-07-20T13:54:38+00:00"
         },
         {
             "name": "asm89/stack-cors",
index 89e30f5b47e2ac69bf3e88b3aa3a2f37e3ccf9af..18a37d76af74dd0d2140ff5f1edddbaccd9610b7 100644 (file)
@@ -31,6 +31,11 @@ return [
                     'title' => 'Articles',
                     'module' => true
                 ],
+                'podcasts' => [
+                    'title' => 'Podcasts',
+                    'module' => true
+                ]
+
 
         ]
     ],
index 3ab429e2ec81346f2ef96ccb9a5ff2b5da58324e..7f2de7b4e370348793f948e50b219d76c77fabac 100644 (file)
@@ -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 (file)
index 0000000..4152209
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+
+class CreatePodcastsTables extends Migration
+{
+    public function up()
+    {
+        Schema::create('podcasts', 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('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');
+    }
+}
index 9868a2968897e7298355fcff817f05806420db6b..d182db91193d760ad585f7d549bc423d2ec39a64 100644 (file)
@@ -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 (file)
index 0000000..4625413
--- /dev/null
@@ -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 (file)
index 0000000..f77c9ca
--- /dev/null
@@ -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
index fded5c8c567c9857fa064d756381cdb6eb53869b..3cb215410e2f36bb30f1623b239e1447b26a8efb 100644 (file)
@@ -6,7 +6,7 @@
         </a>
     </div>
     <div>
-        <a href="#">
+        <a href="{{route('AdCampaignController@index')}}">
             <img src="{{asset('img/nav/2-lacom.svg')}}" alt="Pill Icon">
             <p>Campagnes<br>&<br>Com&shy;munication</p>
         </a>
index f9ee98c6484c0b31ec6e21cfd17111a87449fd8c..660c63246fcdf11800a653b4d249ac766e4e90e6 100644 (file)
@@ -6,6 +6,7 @@ Route::group(['prefix' => 'content'], function() {
     Route::module('articles');
     Route::module('adCampaigns');
     Route::module('events');
+    Route::module('podcasts');
 });