]> _ Git - pmi.git/commitdiff
Fix bugs on product links + intro blocks #2738 @0.5
authorStephen Cameron <stephen@cubedesigners.com>
Wed, 28 Aug 2019 13:12:21 +0000 (15:12 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Wed, 28 Aug 2019 13:12:21 +0000 (15:12 +0200)
resources/views/components/link-button.blade.php
resources/views/pages/application.blade.php
resources/views/pages/product-detail.blade.php
resources/views/pages/products.blade.php
resources/views/partials/intro.blade.php
resources/views/partials/product-link.blade.php

index 38081d43655e3530a3ccf567741ce4e85b5e15b1..de99800f0c7f54d3d69f39628b1fa3debffff0d3 100644 (file)
@@ -1,17 +1,17 @@
 @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 = $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'];
+        $text = $data['label'];
     }
 @endphp
 
index 168934cd3c1151b99fe8efc4816b9ed05c962bfe..ffd3e57efa886fde9306ada34924acd551b8e75e 100644 (file)
@@ -24,8 +24,8 @@
 
             {{-- Product Grid --}}
             <grid cols="auto" class="products-grid">
-                @foreach($related as $id=>$rel)
-                    @include('partials.product-link',['id'=>$id,'product'=>$rel])
+                @foreach($related as $id => $rel)
+                    @include('partials.product-link', ['id' => $id, 'product' => $rel])
                 @endforeach
             </grid>
 
index 49bed87ec2d4901d481b031d607ea85c3b4b02c0..d29a1724463f7e6a173be34ef625e6b79affd2da 100644 (file)
 
                 {{-- Product Grid --}}
                 <grid cols="auto" class="products-grid">
-                    @foreach($related as $id=>$rel)
-                        @include('partials.product-link',['id'=>$id,'product'=>$rel])
+                    @foreach($related as $id => $rel)
+                        @include('partials.product-link', ['id' => $id, 'product' => $rel])
                     @endforeach
                 </grid>
 
index f2cdf35b307e402a3151785656106ccde8abb019..af9c202797b1eb940c91f811bbb14f54cecb9b0b 100644 (file)
@@ -93,8 +93,8 @@
 
                 {{-- Product Grid --}}
                 <grid cols="auto" class="products-grid mt-6">
-                    @foreach($products as $id=>$product)
-                        @include('partials.product-link',['id'=>$id,'product'=>$product])
+                    @foreach($products as $id => $product)
+                        @include('partials.product-link', ['id' => $id, 'product' => $product])
                     @endforeach
                 </grid>
             </div>
index f4f3c87a6964730341b4432175ae6cb10f151167..0a7578069fce5ee68e6e0ddb8fae0c6afb1c6e4f 100644 (file)
@@ -8,7 +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");
+    $button = $page->get("$name.button");
 @endphp
 
 <full-width :padding="$padding" :class="$class">
@@ -25,7 +25,9 @@
                 <text-block class="pt-2v" title-class="h1 overlap-left" :title="$title">
                     <p>@markdown($page->get("$name.text"))</p>
 
-                    <p><link-button :data="$button"/></p>
+                    @if ($button)
+                        <p><link-button :data="$button"/></p>
+                    @endif
                 </text-block>
             </column>
         </columns>
index 1a5692754f436cf40bade573573b14b3cdb58c1c..cc90d0c3f8837b6219d3d1b7837b8c2c2229dad2 100644 (file)
@@ -1,6 +1,6 @@
 <div data-product-id="{{$id}}" class="product-grid-item bg-grey-200">
     {{-- Image holder --}}
-    <a href="{{ $product->URL }}">
+    <a href="{{ $product->getEntity()->URL }}">
         <div class="product-img-holder">
             <div class="product-img"
                  style="background-image: url({{ $product->getEntity()->image }})"></div>
@@ -9,13 +9,13 @@
 
     {{-- Product details --}}
     <div class="p-4">
-        <h3><a class="text-navy" href="{{ $product->URL }}">{{ $product->get('reference') }}</a>
+        <h3><a class="text-navy" href="{{ $product->getEntity()->URL }}">{{ $product->get('reference') }}</a>
         </h3>
         <div class="product-highlights text-sm">
             {{$product->get('name')}}
         </div>
         <p class="mt-4">
-            <a href="{{ $product->URL }}">
+            <a href="{{ $product->getEntity()->URL }}">
                 {{ __('Voir la fiche produit') }}
             </a>
         </p>