]> _ Git - pmi.git/commitdiff
WIP #4893 @30
authorStephen Cameron <stephen@cubedesigners.com>
Fri, 4 Feb 2022 23:49:49 +0000 (00:49 +0100)
committerStephen Cameron <stephen@cubedesigners.com>
Fri, 4 Feb 2022 23:49:49 +0000 (00:49 +0100)
21 files changed:
app/Http/Controllers/Admin/PageCrudController.php
app/Models/Application.php
app/Models/News.php
app/SubForms/ImageBlock.php [new file with mode: 0644]
app/Templates/Category.php
app/Templates/CategoryListing.php [new file with mode: 0644]
app/Templates/Home.php
app/Templates/News.php
app/Templates/Placeholder.php [new file with mode: 0644]
app/Templates/Solution.php
app/Templates/SolutionPlaceholder.php [new file with mode: 0644]
resources/styles/components/navigation.styl
resources/styles/components/solutions.styl
resources/views/components/application-item.blade.php [new file with mode: 0644]
resources/views/components/link-button.blade.php
resources/views/components/news-item.blade.php
resources/views/pages/category_listing.blade.php [new file with mode: 0644]
resources/views/pages/home.blade.php
resources/views/pages/news.blade.php
resources/views/pages/solution.blade.php
resources/views/partials/product-link.blade.php

index 12ca6402ddbaf9f7006607c746f7a60e69f8ee0d..23a2dc6c1337c0d9377526eb49df4db270c09724 100644 (file)
@@ -13,4 +13,13 @@ class PageCrudController extends CubistMagicNestedController
     protected $_clonable = true;
     protected $_bulk = true;
     protected $_oneInstance= false;
+
+    public function setup() {
+        parent::setup();
+
+        // Override max menu depth when re-ordering. There's a parent level (eg. #main or #footer)
+        // so an extra level is needed to allow 4 menu levels on front-end. A depth setting of 0 = infinite.
+        // Ref: https://backpackforlaravel.com/docs/3.6/crud-operation-reorder
+        $this->crud->enableReorder('name', 5);
+    }
 }
index f3fb0112040da6818fbc96d35e178d864faec0cd..b84c7c7334d7e33de43bd8d461b024a205c80a5d 100644 (file)
@@ -67,4 +67,10 @@ class Application extends CubistMagicPageModel
 
         parent::setFields();
     }
+
+    // Custom accessor: ->title_solutions_variant
+    // Provides more context (mainly used for Applications 'SelectFromModel' field in Solutions template)
+    public function getTitleSolutionsVariantAttribute() {
+        return $this->title_solutions . ' ['. implode(', ', $this->variant) .']';
+    }
 }
index 534eebfe994fcbe74cc9d488f4058282cb2e3dca..c9a563b7ea771428804063d774d44741785c308e 100644 (file)
@@ -11,6 +11,9 @@ use Cubist\Backpack\app\Magic\Models\News as BaseNews;
 
 class News extends BaseNews
 {
+    public $thumb_width = 348;
+    public $thumb_height = 196;
+
     public function registerMediaConversions(Media $media = null)
     {
         parent::registerMediaConversions($media);
@@ -19,7 +22,7 @@ class News extends BaseNews
             ->width(768);
 
         $this->addMediaConversion('index_thumb')
-            ->crop(Manipulations::CROP_CENTER, 348, 196);
+            ->crop(Manipulations::CROP_CENTER, $this->thumb_width, $this->thumb_height);
     }
 
     public static function getPosts($per_page = 8, $exclude = null) {
@@ -61,7 +64,13 @@ class News extends BaseNews
             return $fallback;
         }
 
-        return '<img class="'. $class .'" src="'. $src .'" alt="'. $alt .'">';
+        // Include thumbnail dimensions to avoid grid jumping as post images are loaded
+        // Ideally this should be based on actual dimensions of each image but for now it'll do
+        // See: https://github.com/spatie/laravel-medialibrary/issues/893
+        $dimensions = ($size == 'index_thumb') ?
+            'width="'. $this->thumb_width .'" height="'. $this->thumb_height .'"' : '';
+
+        return '<img class="'. $class .'" src="'. $src .'" alt="'. $alt .'" '. $dimensions .'>';
     }
 
     public function getURL($id) {
diff --git a/app/SubForms/ImageBlock.php b/app/SubForms/ImageBlock.php
new file mode 100644 (file)
index 0000000..497774b
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace App\SubForms;
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class ImageBlock extends SubForm
+{
+
+
+    public function init()
+    {
+        parent::init();
+        $this->addField(['name' => 'title',
+            'label' => 'Titre',
+            'type' => 'Text']);
+
+        $this->addField(['name' => 'text',
+            'label' => 'Texte',
+            'type' => 'Textarea',
+            'attributes' => [
+                'rows' => 4,
+            ],
+        ]);
+
+        $this->addField(['name' => 'image',
+            'label' => 'Image',
+            'type' => 'Images']);
+
+        $this->addField(['name' => 'button',
+            'label' => 'Lien',
+            'type' => 'Button']);
+    }
+}
index 1c18ad49be219415516c259bcbfbe2068e8a201a..1e28c42d4532bea3c760469c16c49679e5a386b7 100644 (file)
@@ -39,6 +39,12 @@ class Category extends Base
             'type' => 'Text',
             'label' => 'Filtres',
             'tab' => 'Catégorie']);
+
+        $this->addField(['name' => 'highlights',
+            'type' => 'Markdown',
+            'label' => 'Liste de 3 highlights affichés sur le template « Listing Catégories »',
+            'tab' => 'Highlights']);
+
     }
 
     public function setData(&$data)
diff --git a/app/Templates/CategoryListing.php b/app/Templates/CategoryListing.php
new file mode 100644 (file)
index 0000000..b349515
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+
+namespace App\Templates;
+
+use App\Models\Application;
+use App\Models\Page;
+use Cubist\Backpack\app\Magic\PageData;
+
+class CategoryListing extends Base
+{
+    public function getName()
+    {
+        return 'Catégorie (Listing)';
+    }
+
+    public function init()
+    {
+        parent::init();
+
+        $this->addField([
+            'name' => 'intro',
+            'type' => 'BunchOfFields',
+            'bunch' => 'App\SubForms\Intro',
+            'label' => 'Introduction',
+            'tab' => 'Introduction',
+            'translatable' => true,
+        ]);
+
+        $this->addField(['name' => 'related_applications',
+                         'label' => 'Applications associées',
+                         'type' => 'SelectFromModel',
+                         'optionsmodel' => Application::class,
+                         'multiple' => true,
+                         'attribute' => 'title',
+                         'tab' => 'Applications Associées',
+        ]);
+    }
+
+    public function setData(&$data)
+    {
+        parent::setData($data);
+
+        // Get all the child pages of this page that use the template 'category'.
+        // These will be used to populate the grid of sub-categories
+        $current_page_ID = $data['page']->id;
+        $categories = Page::with('media')
+                        ->where('parent_id', $current_page_ID)
+                        ->where('template', 'category')
+                        ->orderBy('lft')
+                        ->get();
+
+        $data['categories'] = [];
+
+        foreach ($categories as $category) {
+            $data['categories'][$category->id] = $category->getPageData();
+        }
+
+        // Get related applications, if any
+        if (isset($data['page']->related_applications) && count($data['page']->related_applications) > 0) {
+            $data['applications'] = PageData::fromEntities(Application::whereVariant()->whereIn('id', $data['page']->related_applications)->get());
+        }
+    }
+}
index f9f61c42a6425b22a371d1bd92d57b15f4c05a04..fb2ae07ca6e514538a884cdcf3e28f9173267769 100644 (file)
@@ -2,7 +2,9 @@
 
 namespace App\Templates;
 
+use App\Models\Application;
 use App\Models\News;
+use Cubist\Backpack\app\Magic\PageData;
 
 class Home extends Base
 {
@@ -21,6 +23,22 @@ class Home extends Base
     {
         parent::init();
 
+        $this->removeField('intro'); // Replaced by custom intro fields below
+
+        $this->addField(['name' => 'our_business_title',
+            'label' => 'Titre',
+            'type' => 'Text',
+            'tab' => 'Intro']);
+
+        $this->addField([
+            'name' => 'our_business_details',
+            'type' => 'BunchOfFieldsMultiple',
+            'bunch' => 'App\SubForms\ImageBlock',
+            'label' => 'Notre métier',
+            'tab' => 'Intro',
+        ]);
+
+
         $this->addField([
             'name' => 'slideshow',
             'type' => 'BunchOfFieldsMultiple',
@@ -66,15 +84,11 @@ class Home extends Base
     // Set extra data for Home blade view
     public function setData(&$data)
     {
-        $page = $data['page'];
+        // Latest News posts
+        $data['news'] = News::getPosts(4);
 
-        // News data
-        $data['news'] = $this->_getNews();
-    }
-
-    protected function _getNews()
-    {
-        return News::getPosts(4);
+        // Latest Applications
+        $data['applications'] = PageData::fromEntities(Application::with('media')->whereVariant()->latest()->take(4)->get());
     }
 
 
index 812091967b84c8367d61268d6f7b2448ab3c6578..5ce5bfd91624be97a15509c8cf33dfec34a93003 100644 (file)
@@ -25,16 +25,14 @@ class News extends Base
         Debugbar::startMeasure('nav_news', 'Make news nav items');
         parent::setMenuChildren($menu);
 
-        $news = NewsModel::whereVariant()->get();
+        $locale = app()->getLocale();
 
-        $i = 0;
+        $news = NewsModel::whereVariant()
+            ->where("status->$locale", 1)
+            ->whereDate('date', '<=', Carbon::now())
+            ->get();
 
         foreach ($news as $newsItem) {
-            // Don't include offline items
-            if ($newsItem->getPageData()->get('status') != 1) {
-                continue;
-            }
-
             $item = new PageItem();
             $item->initFromEntity($newsItem);
             $item->setLocale($menu->getLocale());
diff --git a/app/Templates/Placeholder.php b/app/Templates/Placeholder.php
new file mode 100644 (file)
index 0000000..a271b80
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Templates;
+
+use Cubist\Backpack\app\Template\TemplateAbstract;
+
+/*
+ * The purpose of this template is to create a virtual page entry that can be used in the menu without being clickable.
+ * It is used for nested menus where certain levels are just labels / placeholders that contain other pages.
+ * This is an alternative to the FirstRedirection template.
+ */
+class Placeholder extends TemplateAbstract {
+    protected $_virtual = true;
+    protected $_navigable = false;
+
+    public function getName()
+    {
+        return '* Placeholder (lien non-actif)';
+    }
+
+    public function init()
+    {
+        parent::init();
+    }
+}
index 4a483e6a220fb6235e9541babcbd2d0b90b24d5f..17c1f5c9ac55bbd971396bc6ae32ea3fd1dc6f5f 100644 (file)
@@ -10,6 +10,8 @@ use Cubist\Backpack\app\Magic\PageData;
 
 class Solution extends Base
 {
+    protected static $_applications = [];
+
     public function getName()
     {
         return 'Solution';
@@ -23,7 +25,7 @@ class Solution extends Base
             'label' => 'Applications',
             'type' => 'SelectFromModel',
             'optionsmodel' => 'App\Models\Application',
-            'attribute' => 'title_solutions',
+            'attribute' => 'title_solutions_variant', // Custom accessor provides more detail
             'order' => true,
             'multiple' => true,
             'tab' => 'Applications']);
@@ -34,17 +36,16 @@ class Solution extends Base
         Debugbar::startMeasure('nav_applications', 'Make applications nav items');
         parent::setMenuChildren($menu);
 
-        $applications = Application::whereVariant($menu->getVariant())->get();
-
         $solution_apps = $menu->getPageData()->get('applications');
-        if (null === $solution_apps || !$solution_apps) {
+
+        if (null === $solution_apps || !is_array($solution_apps)) {
             return;
         }
 
+        $applications = self::_getApplications($menu->getVariant(), $menu->getLocale());
+
         foreach ($applications as $application) {
-            if (!in_array($application->id, $solution_apps)) {
-                continue;
-            }
+
             $item = new PageItem();
             $item->initFromEntity($application);
             $item->setVariant($menu->getVariant());
@@ -53,7 +54,13 @@ class Solution extends Base
             $item->setHref($application->getSlugOrTitleAttribute());
             $item->setId('application/' . $application->id);
             $item->setController(['controller' => 'ApplicationController', 'action' => 'view', 'params' => ['id' => $application->id]]);
-            $item->showInAllMenus();
+
+            if (!in_array($application->id, $solution_apps)) {
+                $item->hideInAllMenus();
+            } else {
+                $item->showInAllMenus();
+            }
+
             $menu->addChild($item);
         }
 
@@ -66,6 +73,22 @@ class Solution extends Base
             $data['applications'] = [];
             return;
         }
-        $data['applications'] = PageData::fromEntities(Application::whereIn('id', $data['page']->applications)->get());
+        $data['applications'] = PageData::fromEntities(Application::whereVariant()->whereIn('id', $data['page']->applications)->get());
+    }
+
+    /**
+     * @param $variant
+     * @param $locale
+     * @return Application[]
+     */
+    public static function _getApplications($variant, $locale)
+    {
+        if (!isset(self::$_applications[$variant][$locale])) {
+            self::$_applications[$variant][$locale] = [];
+        }
+        if (empty(self::$_applications[$variant][$locale])) {
+            self::$_applications[$variant][$locale] = Application::whereVariant($variant)->get();
+        }
+        return self::$_applications[$variant][$locale];
     }
 }
diff --git a/app/Templates/SolutionPlaceholder.php b/app/Templates/SolutionPlaceholder.php
new file mode 100644 (file)
index 0000000..7d70a96
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+
+
+namespace App\Templates;
+
+use Barryvdh\Debugbar\Facade as Debugbar;
+
+/*
+ * The purpose of this template is to create a virtual page entry that can be used in the menu without being clickable.
+ * It inherits from the Solution template and is similar in that it will have any associated Applications added as
+ * child pages in the menu. However, there is no page that can be visited directly - it's parent wrapper only.
+ */
+class SolutionPlaceholder extends Solution
+{
+    protected static $_applications = [];
+
+    public function getName()
+    {
+        return 'Solution (placeholder)';
+    }
+
+    public function init()
+    {
+        parent::init();
+
+        $this->removeField('intro');
+    }
+
+    public function setMenuChildren($menu)
+    {
+        Debugbar::startMeasure('nav_applications_placeholder', 'Make applications nav items (placeholder template)');
+        parent::setMenuChildren($menu);
+        Debugbar::stopMeasure('nav_applications_placeholder');
+    }
+}
index e4bcb4b8acf9a10bfbdce79572f6389cab2e77ca..74b44f150077d01789b9110d97735c27259bf2d1 100644 (file)
@@ -8,8 +8,11 @@
 .nav-primary
   @apply flex mx-auto px-8
 
-  // Top level items
+  // Trigger for submenus, at any depth
+  li:hover > ul
+    display: block // Or set to flex so we can have 2 menus side-by-side in submenu
 
+  // Top level items
   > li
     @apply py-4
     //position: relative
     &:not(:last-child)
       @apply mr-10
 
-    &:hover
-      > ul // First level submenus
-        display: block // Set to flex so we can have 2 menus side-by-side in submenu
-        animation: submenu-fade-in 0.3s
-
-  // Top level links
-
-  > li > a
-    @apply text-inherit cursor-pointer
-    white-space nowrap
+    // Top level links
+    > a
+      @apply text-inherit cursor-pointer
+      white-space nowrap
 
-    &:hover
-      @apply text-primary
+      &:hover
+        @apply text-primary
 
+  // 1st level Submenus
+  > li > ul
+    margin-top: 1rem // Extra margin to replace top: 100% (see IE11 notes above)
+    animation: submenu-fade-in 0.3s
 
-  // Submenus
+  // Any Submenus below the first level
+  > li > ul li > ul
+    top: -1rem // To offset extra padding on <li>s (sub-submenus are relative to parent <li>)
+    left: 100%
 
+  // ALL Submenus
   > li ul
     @apply bg-white text-base shadow-2xl
-    //top: 100%
-    //left: 0
-    position: absolute
+    position: absolute // Any deeper submenus will be relative to the parent <ul>
     display: none
-    margin-top: 1rem // Extra margin to replace top: 100% (see IE11 notes above)
     padding: 1em 0
+    max-width: 450px
 
     li
-      &:hover, &.active
-        > a
-          @apply text-primary
-          transform: translateX(0)
-
-          &:before
-            transform: scaleX(1)
-
-
-  > li > ul // Only target 1st level of submenu items
-    max-width 450px
-
-    > li a span
-      max-width 350px
-      white-space nowrap
-      overflow hidden
-      text-overflow ellipsis
-
-    > li
-      position relative
+      position: relative
 
+      // Animate / activate submenu links
       &:hover, &.active
         > a
           @apply text-primary
           &:before
             transform: scaleX(1)
 
-      &:hover
-        > ul
-          display block
-
-      > ul
-        position absolute
-        left 100%
-        top: -32px
-        display none
-        max-width 450px
-
-        > li a span
-          display: block;
-          max-width 350px
-          white-space nowrap
-          overflow hidden
-          text-overflow ellipsis
-
     // Submenu links
-
     a
       @apply text-navy flex items-center w-full py-2
       white-space: nowrap
       transform: translateX(-2em)
 
       // Animated dash before link
-
       &:before
         content: ''
         display: block
         transform: scaleX(0)
         transform-origin: right
 
-    // Set transition for links - same for both elements
-
+    // Set transition for links - same for both elements so animated dash and text shift are synchronised
     a, a:before
       transition: transform 0.2s ease-out
 
+    // Submenu link text
+    a span
+      max-width: 350px
+      white-space: nowrap
+      overflow: hidden
+      text-overflow: ellipsis
+
 #mobile-nav
   +below($breakpoint-menu)
     display: block
index 6ed0c11eee3340ad5963566201aa1152740a0084..99c684da89f9f996444c6fa770df13b27637ce96 100644 (file)
@@ -38,7 +38,7 @@
     constrain(right, 1.75vw)
     constrain(bottom, 2.5vw)
 
-    +below(900px)
+    +below(1200px)
       @apply text-xl
 
     &:after
diff --git a/resources/views/components/application-item.blade.php b/resources/views/components/application-item.blade.php
new file mode 100644 (file)
index 0000000..27bbb7a
--- /dev/null
@@ -0,0 +1,22 @@
+<article>
+
+    <a href="{{ $item->getURL($item->id) }}" class="block bg-grey-100">
+        {!! $item->get() !!}
+    </a>
+
+    <div class="mt-6">
+        <time datetime="{{ $item->date->toDateTimeLocalString() }}"
+              class="block font-display font-medium text-navy">
+            {{ $item->date->format('d/m/y') }}
+        </time>
+        <h4 class="text-2xl sm:text-xl mt-2">
+            <a class="text-navy" href="{{ $item->getURL($item->id) }}">
+                {{ $item->title }}
+            </a>
+        </h4>
+        <p>{{ $item['chapo'] }}</p>
+
+        <p><a href="{{ $item->getURL($item->id) }}">{{ __("Lire l'article") }}</a></p>
+    </div>
+
+</article>
index de99800f0c7f54d3d69f39628b1fa3debffff0d3..a32aedd44836495051ab6264b84e50f1b6e84131 100644 (file)
@@ -1,5 +1,7 @@
 @php
     $text = $slot;
+    $type = $type ?? 'button';
+    $base_class = ($type === 'link') ? 'animated-underline' : 'btn';
     $enabled = true;
     if (isset($data) && is_array($data)) {
         if ($data['type'] == 'none') {
@@ -16,7 +18,7 @@
 @endphp
 
 @if($enabled && $text)
-    <a href="{{ $href ?? '#' }}" class="btn {{ $class ?? '' }}">
+    <a href="{{ $href ?? '#' }}" class="{{ $base_class }} {{ $class ?? '' }}">
         <span class="btn-text">{{ $text }}</span>
     </a>
 @endif
index adf66f3ec5d64a6a3fd188ff477436b20e032d70..836daa0d74884dfd6565eb6a50cbb5a63324ae64 100644 (file)
@@ -1,6 +1,6 @@
 <article>
 
-    <a href="{{ $item->getURL($item->id) }}" class="news-index-article-image">
+    <a href="{{ $item->getURL($item->id) }}" class="news-index-article-image block bg-grey-100">
         {!! $item->getThumbnailImage() !!}
     </a>
 
diff --git a/resources/views/pages/category_listing.blade.php b/resources/views/pages/category_listing.blade.php
new file mode 100644 (file)
index 0000000..5685e23
--- /dev/null
@@ -0,0 +1,65 @@
+@extends('layouts/app')
+
+@section('content')
+    <script>
+        window.baseFilters = "{{$page->get('filter')}}";
+    </script>
+    @intro(['padding' => 'pb-1v'])
+
+    <full-width class="bg-grey-100" padding="pt-3v pb-3v">
+
+        <content>
+
+            <grid cols="4" gap="lg" class="md:grid-cols-3 sm:grid-cols-2 xs:grid-cols-1">
+                @foreach($categories as $category)
+                    @php
+                        $URL = $nav->getHrefById($category->id);
+                    @endphp
+                    <div class="bg-white">
+                        {{-- Image Holder --}}
+                        <div class="bg-grey-200 bg-cover"
+                             style="background-image:url({{ $category->getImageURLByCollection($category->intro['image']) }})">
+                            {{-- Image sizer + link --}}
+                            <a href="{{ $URL }}" class="block" style="padding-bottom: 56.32%"></a>
+                        </div>
+
+                        {{-- Details --}}
+                        <div class="p-6">
+                            <h3>
+                                <a href="{{ $URL }}" class="text-navy text-2xl">
+                                    {{ $category->intro['title'] }}
+                                </a>
+                            </h3>
+                            <div class="my-6">
+                                @markdown($category->highlights)
+                            </div>
+
+                            <a href="{{ $URL }}">{{ __('En savoir plus') }}</a>
+                        </div>
+                    </div>
+                @endforeach
+            </grid>
+
+        </content>
+
+    </full-width>
+
+    @isset($applications)
+        <full-width padding="pt-3v pb-3v">
+            <content>
+                <text-block :title="__('Quelques applications')"></text-block>
+                <grid cols="4" class="sm:grid-cols-2 xs:grid-cols-1">
+                    @foreach ($applications as $application)
+                        <a class="solutions-link" href="{{ $nav->getHrefByID('application/'.$application->id) }}">
+                            <div class="solutions-link-sizer"></div>
+                            <span class="solutions-link-bg"
+                                  style="background-image:url({{ $application->getImageURLbyCollection($application['image_solutions'], 'thumb') }})"></span>
+                            <span class="solutions-link-text">{{ $application->title_solutions }}</span>
+                        </a>
+                    @endforeach
+                </grid>
+            </content>
+        </full-width>
+    @endisset
+
+@endsection
index 14aa1d6594295fb6ee6d01744f9fa63836d7bcd0..20f5383527320cb7a22c5e7fe0c8d18bdf8ee172 100644 (file)
@@ -37,7 +37,7 @@
                             </text-block>
                         </column>
                         <column
-                            class="overlap-bottom md:-mr-2v sm:-ml-2v sm:mb-0 slide-content slide-img-container relative">
+                            class="-mb-1v z-10 md:-mr-2v sm:-ml-2v sm:mb-0 slide-content slide-img-container relative">
                             <div class="slide-mask">
                                 <div class="bg-image h-full bg-cover bg-no-repeat slide-img">
                                     <img class="img-slider" draggable="false" ondragstart="return false;"
         </div>
     </section>
 
-    {{-- Intro text --}}
-    @intro(['title_tag' => 'h2', 'padding' => 'pt-5v pb-4v'])
+    {{-- Intro Section --}}
+    <full-width padding="pt-4v pb-3v">
+        <content>
+            <text-block :title="$page->get('our_business_title')" title-tag="h2" title-class="h2"></text-block>
+
+            <grid cols="3" gap="lg" class="sm:grid-cols-1">
+                @foreach($page->get('our_business_details', []) as $business_detail)
+                    <div>
+                        <div class="bg-grey-100 bg-cover" style="padding-bottom: 56.25%; background-image:url({{ $page->getImageUrlByCollection($business_detail['image']) }})"></div>
+                        <h3 class="font-semibold text-4xl lg:text-3xl md:text-2xl leading-none my-6 sm:mb-4">{{ $business_detail['title'] }}</h3>
+                        <p>{{ $business_detail['text'] }}</p>
+                        <link-button :data="$business_detail['button']" type="link" />
+                    </div>
+
+                @endforeach
+            </grid>
+        </content>
+    </full-width>
+
 
     {{-- Our products --}}
     <full-width class="bg-grey-100">
         <content>
             <text-block title-class="h1 text-inherit" :title="__('Solutions / Applications')"/>
 
-            <grid cols="3" class="sm:grid-cols-2 xs:grid-cols-1">
+            <grid cols="4" class="sm:grid-cols-2 xs:grid-cols-1">
                 @foreach ($page->get('solutions', []) as $solution)
                     <a class="solutions-link" href="{{ $nav->getHrefByID($solution['page']) }}">
                         <div class="solutions-link-sizer"></div>
     {{-- Services & Support --}}
     @intro(['name' => 'services_support', 'title_tag' => 'h2', 'class' => 'bg-grey-100'])
 
+    @if(count($applications) > 0)
+        {{-- News --}}
+        <full-width padding="pt-3v">
+            <content>
+                <text-block :title="__('Notes d’application')"/>
+                <grid cols="4" class="sm:grid-cols-2 xs:grid-cols-1">
+                    @foreach ($applications as $application)
+                        <a class="solutions-link" href="{{ $nav->getHrefByID('application/'.$application->id) }}">
+                            <div class="solutions-link-sizer"></div>
+                            <span class="solutions-link-bg"
+                                  style="background-image:url({{ $application->getImageURLbyCollection($application['image_solutions'], 'thumb') }})"></span>
+                            <span class="solutions-link-text">{{ $application->title_solutions }}</span>
+                        </a>
+                    @endforeach
+                </grid>
+            </content>
+        </full-width>
+    @endif
+
     @if(config('features.news') && count($news) > 0)
         {{-- News --}}
         <full-width>
index 5dfd8f98103bdc34980ba9f6f5bf8943466fd86f..f4507cfc3dd491c3ffe3d6a10a999a9317db10a8 100644 (file)
                               class="block font-display font-medium text-navy mb-4">
                             {{ $featured_news->date->format('d/m/y') }}
                         </time>
-                        <h4 class="h1 simple leading-none mb-8">{{ $featured_news->title }}</h4>
+                        <h4 class="h1 simple leading-none mb-8">
+                            <a class="text-navy" href="{{ $featured_news->getURL($featured_news->id) }}">
+                                {{ $featured_news->title }}
+                            </a>
+                        </h4>
                         <p class="font-display font-medium text-navy">{{ $featured_news->chapo }}</p>
 
                         <p>
index b7bc947f09fbaa2b9022cc19705968bb8562d092..eaabb2b6acee98d34417acb43fa702ed7565af2a 100644 (file)
 
             <grid cols="4" class="sm:grid-cols-2 xs:grid-cols-1">
                 @foreach ($applications as $application)
+{{--                    @dump($application->id, $nav->getHrefByID('application/'.$application->id))--}}
                     <a class="solutions-link" href="{{ $nav->getHrefByID('application/'.$application->id) }}">
                         <div class="solutions-link-sizer"></div>
                         <span class="solutions-link-bg"
-                              style="background-image:url({{ $application->getImageURLbyCollection($application['image_solutions']) }})"></span>
+                              style="background-image:url({{ $application->getImageURLbyCollection($application['image_solutions'], 'thumb') }})"></span>
                         <span class="solutions-link-text">{{ $application->title_solutions }}</span>
                     </a>
                 @endforeach
index c2a31785f1f1a060a7320cd240125aa4a4cefddf..1514af35fd90a034da4ce50b96bb946b2b2ef086 100644 (file)
@@ -1,20 +1,20 @@
 @php
     $technical_sheet = $product->getMediaUrl('technical_sheet', false)
 @endphp
-<div data-product-id="{{$id}}" class="product-grid-item bg-grey-200">
+<div data-product-id="{{ $id }}" class="product-grid-item bg-grey-200">
     {{-- Image holder --}}
     <a href="{{ $product->getEntity()->getURLAttribute() }}" class="">
         <div class="product-img-holder">
             <div class="product-img">
-                <img src="{{$product->getEntity()->image}}"
-                     alt="{{$product->getEntity()->image_alt}}"/>
+                <img src="{{ $product->getEntity()->image }}"
+                     alt="{{ $product->getEntity()->image_alt }}"/>
             </div>
         </div>
     </a><!--
     There shoulln't be any space between closing of a and opening of div
     {{-- Product details --}}
     --><div class="product-content p-4">
-        <h3><a class="text-navy" href="{{ $product->getEntity()->getURLAttribute() }}">{{ $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')}}
@@ -24,7 +24,7 @@
         @endif
         <div class="links mt-4">
             <div class="link">
-                <a href="{{ $product->getEntity()->getURLAttribute() }}">
+                <a href="{{ $product->getEntity()->URL }}">
                     {{ __('En savoir plus') }}
                 </a>
             </div>