]> _ Git - pmi.git/commitdiff
WIP #2738 @6
authorStephen Cameron <stephen@cubedesigners.com>
Tue, 16 Jul 2019 16:54:58 +0000 (18:54 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Tue, 16 Jul 2019 16:54:58 +0000 (18:54 +0200)
app/Models/News.php
app/Models/Settings.php
app/SubForms/Strength.php [new file with mode: 0644]
resources/views/pages/home.blade.php
resources/views/partials/footer.blade.php

index 1624bb0cf5298cbd455b205a9775d0e9573ab0a4..ceabc086478e4a284d553656f51e74ca6700a8ee 100644 (file)
@@ -2,7 +2,12 @@
 
 namespace App\Models;
 
+use Spatie\MediaLibrary\Models\Media;
+
 class News extends \Cubist\Backpack\app\Magic\Models\News
 {
-
+    public function registerMediaConversions(Media $media = null) {
+        $this->addMediaConversion('thumb')
+             ->crop('crop-center', 348, 232);
+    }
 }
index dd6179117683c8b8e617121d9e51760d6ac4c25e..465177c843257f8c52773b346cc59073d2fb1267 100644 (file)
@@ -36,12 +36,46 @@ class Settings extends \Cubist\Backpack\app\Magic\Models\Settings
             'tab' => __('Réseaux Sociaux'),
         ]);
 
-        // === Forms
+        //=== Forms
         $this->addField([
             'name' => 'form_privacy',
             'type' => 'Markdown',
             'label' => 'Mention légale vie privée affichée sous les formulaires',
             'tab' => 'Formulaires',
         ]);
+
+        //=== Footer
+        $this->addField([
+            'name' => 'footer_text',
+            'type' => 'Textarea',
+            'label' => __('Texte de footer'),
+            'attributes' => [
+                'rows' => 4,
+            ],
+            'tab' => 'Footer',
+        ]);
+
+        $this->addField([
+            'name' => 'footer_heading_contact',
+            'type' => 'Text',
+            'label' => __('Titre de colonne « Nous contacter »'),
+            'tab' => 'Footer',
+        ]);
+
+        $this->addField([
+            'name' => 'footer_heading_strengths',
+            'type' => 'Text',
+            'label' => __('Titre de colonne « PMI à votre service »'),
+            'tab' => 'Footer'
+        ]);
+
+        //=== Strengths / Points Forts
+        $this->addField([
+            'name' => 'strengths',
+            'type' => 'BunchOfFieldsMultiple',
+            'bunch' => 'App\SubForms\Strength',
+            'label' => __('Points Forts'),
+            'tab' => 'Footer',
+        ]);
     }
 }
diff --git a/app/SubForms/Strength.php b/app/SubForms/Strength.php
new file mode 100644 (file)
index 0000000..4033f9b
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+
+namespace App\SubForms;
+
+use Cubist\Backpack\app\Magic\SubForm;
+
+class Strength extends SubForm
+{
+    public function init()
+    {
+        parent::init();
+        $this->addField([
+            'name' => 'title',
+            'label' => __('Titre'),
+            'type' => 'Text',
+        ]);
+
+        $this->addField([
+            'name' => 'description',
+            'label' => __('Description'),
+            'type' => 'Text',
+        ]);
+
+        $this->addField([
+            'name' => 'icon',
+            'label' => __('Picto'),
+            'type' => 'Images',
+            'translatable' => false,
+        ]);
+    }
+}
index ace4d7e2ac174823c29159ea970bb781268c7805..dd7b5cd983768eaf8d0cc3f4c27377e9b84134ef 100644 (file)
 
                         <div>
                             {{--Todo: handle missing images + get correct image size--}}
-                            <img class="mb-4" src="{{ $newsItem->getFirstMediaUrl($newsItem->image) }}" alt="{{ $newsItem->title }}">
+                            <img class="mb-4" src="{{ $newsItem->getFirstMediaUrl($newsItem->image, 'thumb') }}" alt="{{ $newsItem->title }}">
                             <h4 class="font-display">{{ $newsItem->title }}</h4>
                             <p>{{ $newsItem['chapo'] }}</p>
 
index 5bd1475df2074e4b031bc20eed21bcabad6cea74..06eb414ff6deb54bc689242a1923179322df0906 100644 (file)
@@ -6,9 +6,7 @@
                 @include('partials.logo')
             </div>
             <div class="footer-company-info leading-relaxed mb-6">
-                <p>PM instrumentation distribue depuis 1986 des Capteurs et Systèmes de haute technicité.</p>
-                <p>Issue de la société Schaevitz, PM Instrumentation a su développer une gamme de capteurs et systèmes
-                    d’excellente qualité provenant principalement des Etats-Unis.</p>
+                {!! nl2br($global->get('footer_text')) !!}
             </div>
             <div class="footer-social flex">
                 <a class="text-white hover:text-blue mr-6" href="{{ $global->get('social.twitter') }}" target="_blank"
         </div>
 
         <div class="footer-col">
-            <h3 class="footer-col-heading">Nous contacter</h3>
+            <h3 class="footer-col-heading">{{ $global->get('footer_heading_contact', 'Nous contacter') }}</h3>
             @include('partials.contact-details')
         </div>
 
         <div class="footer-col">
-            <h3 class="footer-col-heading">PMI à votre service</h3>
+            <h3 class="footer-col-heading">{{ $global->get('footer_heading_strengths', 'PMI à votre service') }}</h3>
 
             <ul>
-                @for ($i = 1; $i <= 3; $i++)
+                @foreach ($global->get('strengths', []) as $strength)
                     <li class="flex items-center mb-6">
-                        <div class="border-2 w-12 h-12 mr-6 rounded-full"></div>
+                        <img src="{{ $global->getImageURLByCollection($strength['icon']) }}" alt="" class="flex-shrink-0">
                         <div>
-                            Support Individuel<br>
-                            30 ans d'expérience
+                            <span class="font-display font-semibold">{{ $strength['title'] }}</span>
+                            <br/>
+                            <span class="text-grey-200">{{ $strength['description'] }}</span>
                         </div>
                     </li>
-                @endfor
+                @endforeach
             </ul>
         </div>