]> _ Git - pmi.git/commitdiff
done #2904 @6
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 13 Aug 2019 14:36:54 +0000 (16:36 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 13 Aug 2019 14:36:54 +0000 (16:36 +0200)
resources/views/components/flexible-image.blade.php
resources/views/components/link-button.blade.php
resources/views/pages/home.blade.php
resources/views/partials/intro.blade.php

index 41ac4343fbdab6f8a152fc2400e5306621e2dba9..08ec90601355e3ef74271b143aca0216f4387fd5 100644 (file)
@@ -8,11 +8,16 @@
 @if ($src)
 
     @php
+        $url=$src;
+        if(!file_exists($src)){
+            $src=public_path().$src;
+        }
         $meta = getimagesize($src);
         $ratio = $meta[1] / $meta[0] * 100 .'%'; // Height / Width
     @endphp
 
-    <div class="bg-image h-full bg-cover" style="background-image: url({{ asset($src) }}); background-position: {{ $bgPosition ?? 'center' }}">
+    <div class="bg-image h-full bg-cover"
+         style="background-image: url({{ asset($url) }}); background-position: {{ $bgPosition ?? 'center' }}">
 
         {{-- Proportional padding only comes into effect when columns stack (small screens) --}}
         {{-- This makes the image more flexible when in columns... --}}
index b1ad034c31004a5f9404c07b3dd343472aba64b2..6a5a63a14d3f3cbb71fd58f9a736010b4caa75fd 100644 (file)
@@ -1,3 +1,23 @@
-<a href="{{ $href ?? '#' }}" class="btn {{ $class ?? '' }}">
-    <span class="btn-text">{{ $slot }}</span>
-</a>
+@php
+    $text=$slot;
+    $enabled=true;
+    if(isset($data) && is_array($data)){
+        if($data['type']=='none'){
+            $enabled=false;
+        } else if($data['type']=='external_link'){
+            $href=$data['external_link'];
+        }else if($data['type']=='internal_link'){
+            $href='/'.ltrim($data['link'],'/');
+        }else if($data['type']=='page_link'){
+            $href=\Cubist\Backpack\app\Magic\Menu\Menu::internalToHref($data['page_id']);
+        }
+        $text=$data['label'];
+    }
+
+@endphp
+
+@if($enabled)
+    <a href="{{ $href ?? '#' }}" class="btn {{ $class ?? '' }}">
+        <span class="btn-text">{{ $text }}</span>
+    </a>
+@endif
index 58f34d573378bf8097afe9635459f8a8622d6a48..160774124239c5ccc300f755f93c86663fcda535 100644 (file)
@@ -8,34 +8,34 @@
 
 
     {{-- Slider --}}
-    <full-width class="bg-navy text-white antialiased" padding="pt-1v">
-        <content>
-            <columns>
-                <column class="pt-2v pr-1v pb-2v">
+    @foreach($page->get('slideshow') as $slide)
+        <full-width class="bg-navy text-white antialiased" padding="pt-1v">
+            <content>
+                <columns>
+                    <column class="pt-2v pr-1v pb-2v">
 
-                    <text-block title="Wheel Force Transducer" title-class="h1 text-inherit">
+                        <text-block :title="$slide['title']" title-class="h1 text-inherit">
 
-                        <p>
-                            Wheel Force Transducers (WFT) are used for measuring all wheel forces and moments. Field and
-                            laboratory test of passenger cars, light duty trucks, heavy duty trucks, vans, SUVs, class 8
-                            trucks, heavy duty construction and farm equipment.
-                        </p>
+                            <p>
+                                {!! nl2br($slide['text']) !!}
+                            </p>
 
-                        <p>
-                            <link-button href="#test123">Découvrir</link-button>
-                        </p>
+                            <p>
+                                <link-button :data="$slide['button']" />
+                            </p>
 
-                    </text-block>
+                        </text-block>
 
-                </column>
+                    </column>
 
-                <column class="overlap-bottom md:-mr-2v sm:-ml-2v sm:mb-0">
-                    <flexible-image src="storage/uploads/images/home-car.jpg"/>
-                </column>
+                    <column class="overlap-bottom md:-mr-2v sm:-ml-2v sm:mb-0">
+                        <flexible-image :src="$page->getImageURLByCollection($slide['image'])"/>
+                    </column>
 
-            </columns>
-        </content>
-    </full-width>
+                </columns>
+            </content>
+        </full-width>
+    @endforeach
 
     {{-- Intro text --}}
     @intro(['padding' => 'pt-5v pb-4v'])
                         <article>
                             <a href="{{ $newsURL }}">
                                 {{--Todo: handle missing images + get correct image size--}}
-                                <img class="mb-4" src="{{ $newsItem->getFirstMediaUrl($newsItem->image, 'thumb') }}" alt="{{ $newsItem->title }}">
+                                <img class="mb-4" src="{{ $newsItem->getFirstMediaUrl($newsItem->image, 'thumb') }}"
+                                     alt="{{ $newsItem->title }}">
                             </a>
                             <h4 class="font-display">{{ $newsItem->title }}</h4>
                             <p>{{ $newsItem['chapo'] }}</p>
index dc7b91b7b51a87c1e5c44747f1c8c773eb201fd9..f4f3c87a6964730341b4432175ae6cb10f151167 100644 (file)
@@ -8,6 +8,7 @@
     $image = $page->getImageURL("$name.image",'',asset('storage/uploads/images/products-intro.jpg'));
     $class = $class ?? '';
     $padding = $padding ?? null; // Pass null so it doesn't override default padding
+    $button=$page->get("$name.button");
 @endphp
 
 <full-width :padding="$padding" :class="$class">
@@ -22,9 +23,9 @@
 
             <column>
                 <text-block class="pt-2v" title-class="h1 overlap-left" :title="$title">
-                    @markdown($page->get("$name.text"))
+                    <p>@markdown($page->get("$name.text"))</p>
 
-                    {{-- Todo: handle button here... $page->get("$name.button") --}}
+                    <p><link-button :data="$button"/></p>
                 </text-block>
             </column>
         </columns>