]> _ Git - odl.git/commitdiff
wip #4914 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 3 Jan 2022 18:16:56 +0000 (19:16 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 3 Jan 2022 18:16:56 +0000 (19:16 +0100)
app/Http/Controllers/FrontController.php
resources/views/front/home.blade.php

index 885d71c6bf539123a9b8d425c187f6b665654de3..e644bfec19d03a33eeb4c65f85f8ac0cfdec941f 100644 (file)
@@ -2,29 +2,36 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Publication;
 use App\Models\Resource;
 use Cubist\Backpack\Magic\PageData;
 use Cubist\Util\Files\Files;
 
-class FrontController extends Controller {
-    public function splash() {
+class FrontController extends Controller
+{
+    public function splash()
+    {
         return view('front.splash', $this->_getDataFromCMS());
     }
 
-    public function home() {
+    public function home()
+    {
         return view('front.home', $this->_getDataFromCMS());
     }
 
-    public function resources() {
+    public function resources()
+    {
 
         return view('front.resources', $this->_getDataFromCMS());
     }
 
-    public function medialibrary() {
+    public function medialibrary()
+    {
         return view('front.media-library', $this->_getDataFromCMS());
     }
 
-    public function fluidbook($args = '') {
+    public function fluidbook($args = '')
+    {
         if (!$args) {
             $args = [];
         } else {
@@ -48,12 +55,24 @@ class FrontController extends Controller {
 
     }
 
-    protected function _getDataFromCMS() {
-        return ['resources' => $this->_getResourcesFromCMS()];
+    protected function _getDataFromCMS()
+    {
+        return ['resources' => $this->_getResourcesFromCMS(), 'home' => $this->_getHomeFromCMS(), 'medialibrary' => $this->_getMediaLibraryFromCMS()];
     }
 
-    protected function _getResourcesFromCMS() {
-        $res= Resource::find('1')->getPageData();
+    protected function _getHomeFromCMS()
+    {
+        return Publication::find('1')->getPageData();
+    }
+
+    protected function _getMediaLibraryFromCMS()
+    {
+        return [];
+    }
+
+    protected function _getResourcesFromCMS()
+    {
+        $res = Resource::find('1')->getPageData();
         return $res;
     }
 }
index c1192ec5657f82b311f46c1cd9da80c76ecc36b9..71e7f33a74d74f6379e652b53c2cdc7c70a1cee4 100644 (file)
@@ -4,11 +4,7 @@
 
     @php
         // TEMPORARY DATA MOCKUP
-        $logo = '/storage/102/groupe-84.svg';
-        $subtitle = "Découvrez le coeur de l'offre sous forme de feuilleteur interactif";
-        $button = "Découvrir l'offre";
-        $button_link = '/front/coeur/index.html';
-        $illustration = '/storage/137/home-magazine.jpg';
+        $illustration = $home->getImageURLbyCollection($home->get('illustration'));
         $shortcuts = [
             [
                 'title' => 'Ressources',
 
             {{-- Left Column: logo + text + CTA --}}
             <div class="home-left flex flex-1 flex-col justify-center items-center p-6 max-w-[360px]">
-                @if($logo)
-                    <img class="mb-10" src="{{ $logo }}" alt="Logo"
-                         x-show="shown" x-transition.opacity.scale.80.origin.bottom.duration.800ms>
-                @endif
-                @if($subtitle)
-                    <p class="text-center mb-5 max-w-[280px]"
-                       x-show="shown" x-transition.opacity.scale.80.origin.bottom.duration.500ms.delay.100ms>
-                        {{ $subtitle }}
-                    </p>
-                @endif
-                @if($button)
-                    <a class="bg-blue text-white py-4 px-10 rounded-full transition transform hover:scale-105"
-                       href="{{ $button_link }}"
-                       x-show="shown" x-transition.opacity.scale.80.origin.bottom.duration.500ms.delay.100ms>
-                        {{ $button }}
-                    </a>
-                @endif
+                <img class="mb-10" src="{{ $home->getImageURLbyCollection($home->get('logo')) }}" alt="Logo"
+                     x-show="shown" x-transition.opacity.scale.80.origin.bottom.duration.800ms>
+
+                <p class="text-center mb-5 max-w-[280px]"
+                   x-show="shown" x-transition.opacity.scale.80.origin.bottom.duration.500ms.delay.100ms>
+                    {{ $home->get('subtitle') }}
+                </p>
+                <a class="bg-blue text-white py-4 px-10 rounded-full transition transform hover:scale-105"
+                   href="/front/coeur/index.html"
+                   x-show="shown" x-transition.opacity.scale.80.origin.bottom.duration.500ms.delay.100ms>
+                    {{ $home->get('button') }}
+                </a>
             </div>
 
             {{-- Right Column: Illustration image --}}
         </div>
 
         {{-- Link blocks --}}
-        <div class="grid grid-cols-3 gap-6 text-center lg:text-left" x-data="{ shown: false }" x-intersect="shown = true">
-            @foreach($shortcuts as $shortcut)
+        <div class="grid grid-cols-3 gap-6 text-center lg:text-left" x-data="{ shown: false }"
+             x-intersect="shown = true">
+            @foreach($home->get('raccourcis') as $shortcut)
                 <x-link :href="$shortcut['link']"
                         class="group relative
                                flex flex-col lg:flex-row items-center
                                bg-blue text-white p-6 rounded-lg overflow-hidden">
-                    <img class="flex-shrink lg:mr-8 max-h-30 lg:max-h-none lg:w-[40%]" src="{{ $shortcut['image'] }}" alt="">
+                    <img class="flex-shrink lg:mr-8 max-h-30 lg:max-h-none lg:w-[40%]" src="{{ $home->getImageURLbyCollection($shortcut['image']) }}"
+                         alt="">
                     <div class="lg:flex-1 lg:flex-shrink-0 space-y-2">
                         <h3 class="font-semibold uppercase">{{ $shortcut['title'] }}</h3>
                         <p>{{ $shortcut['content'] }}</p>
                         <div class="circle-arrow transition transform group-hover:scale-110"></div>
                     </div>
                     {{-- Initial Mask --}}
-                    <div class="absolute top-0 left-0 w-full h-full bg-white z-1 transition-transform transform origin-top ease-out duration-500"
-                         :class="{ 'scale-y-0': shown }"
-                         style="transition-delay: {{ 300 + $loop->index * 100 }}ms"
+                    <div
+                        class="absolute top-0 left-0 w-full h-full bg-white z-1 transition-transform transform origin-top ease-out duration-500"
+                        :class="{ 'scale-y-0': shown }"
+                        style="transition-delay: {{ 300 + $loop->index * 100 }}ms"
                     >
                     </div>
                 </x-link>