From: Stephen Cameron Date: Wed, 28 Aug 2019 13:12:21 +0000 (+0200) Subject: Fix bugs on product links + intro blocks #2738 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=69ab6711ead6c747b7d280a0a985715e7b77318b;p=pmi.git Fix bugs on product links + intro blocks #2738 @0.5 --- diff --git a/resources/views/components/link-button.blade.php b/resources/views/components/link-button.blade.php index 38081d4..de99800 100644 --- a/resources/views/components/link-button.blade.php +++ b/resources/views/components/link-button.blade.php @@ -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 diff --git a/resources/views/pages/application.blade.php b/resources/views/pages/application.blade.php index 168934c..ffd3e57 100644 --- a/resources/views/pages/application.blade.php +++ b/resources/views/pages/application.blade.php @@ -24,8 +24,8 @@ {{-- Product 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 diff --git a/resources/views/pages/product-detail.blade.php b/resources/views/pages/product-detail.blade.php index 49bed87..d29a172 100644 --- a/resources/views/pages/product-detail.blade.php +++ b/resources/views/pages/product-detail.blade.php @@ -127,8 +127,8 @@ {{-- Product 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 diff --git a/resources/views/pages/products.blade.php b/resources/views/pages/products.blade.php index f2cdf35..af9c202 100644 --- a/resources/views/pages/products.blade.php +++ b/resources/views/pages/products.blade.php @@ -93,8 +93,8 @@ {{-- Product Grid --}} - @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 diff --git a/resources/views/partials/intro.blade.php b/resources/views/partials/intro.blade.php index f4f3c87..0a75780 100644 --- a/resources/views/partials/intro.blade.php +++ b/resources/views/partials/intro.blade.php @@ -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 @@ -25,7 +25,9 @@

@markdown($page->get("$name.text"))

-

+ @if ($button) +

+ @endif
diff --git a/resources/views/partials/product-link.blade.php b/resources/views/partials/product-link.blade.php index 1a56927..cc90d0c 100644 --- a/resources/views/partials/product-link.blade.php +++ b/resources/views/partials/product-link.blade.php @@ -1,6 +1,6 @@