From: Louis Jeckel Date: Wed, 18 Nov 2020 10:17:59 +0000 (+0100) Subject: newsletter X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d733af0970ced094ba147d86ce1ec52129fc0548;p=psq.git newsletter --- diff --git a/app/Http/Controllers/Admin/UnlayerController.php b/app/Http/Controllers/Admin/UnlayerController.php index 4b8e762..023963f 100644 --- a/app/Http/Controllers/Admin/UnlayerController.php +++ b/app/Http/Controllers/Admin/UnlayerController.php @@ -24,20 +24,28 @@ class UnlayerController } public function links() + { + return self::getLinks(); + } + + public static function getLinks() { $classes = collect([ Poll::class => 'Sondage', - LaboArticle::class => 'Article Labo', + LaboArticle::class => 'Actu Labo', SocialArticle::class => 'Article réseaux sociaux', AdCampaign::class => 'Campagnes' ]); - return $classes->map(function ($label, $class) { + return collect([[ + 'name' => 'Liens', + 'specialLinks' => self::getIndexLinks() + ]])->merge($classes->map(function ($label, $class) { return [ 'name' => $label, 'specialLinks' => self::getLinksForClass($class, 5) ]; - })->values(); + })->values()); } @@ -48,4 +56,18 @@ class UnlayerController return $items->map(fn($item) => ['name' => mb_strimwidth($item->title, 0, 35, '…'), 'href' => $item->url]); } + public static function getIndexLinks() + { + $links = collect([ + 'Accueil' => route('home'), + 'Inscription découverte' => route('discover.register'), + 'Form. Contact' => route('contact.index'), + 'Actus Labo' => route('actus-labos.index'), + 'Article réseaux sociaux' => route('actus-labos.index'), + 'Campagnes' => route('com-campaign.index') + ]); + + return $links->map(fn($route, $label) => ['name' => $label, 'href' => $route])->values(); + } + } diff --git a/app/Nova/EmailTemplate.php b/app/Nova/EmailTemplate.php index 4f56294..1ff4dd1 100644 --- a/app/Nova/EmailTemplate.php +++ b/app/Nova/EmailTemplate.php @@ -2,6 +2,7 @@ namespace App\Nova; +use App\Http\Controllers\Admin\UnlayerController; use IDF\NovaUnlayerField\Unlayer; use Illuminate\Http\Request; use Laravel\Nova\Fields\Boolean; @@ -67,16 +68,7 @@ class EmailTemplate extends Resource 'projectId' => config('services.unlayer.projectId'), 'templateId' => $this->design === null ? 20390 : null, 'locale' => app()->getLocale(), - 'specialLinks' => [ - [ - 'name' => 'Home', - 'href' => route('home'), - ], - [ - 'name' => 'Contact', - 'href' => route('contact.index') - ], - ], + 'specialLinks' => UnlayerController::getLinks(), 'tools' => [ 'menu' => [ 'enabled' => false,