]> _ Git - pmi.git/commitdiff
WIP #2738 @7
authorStephen Cameron <stephen@cubedesigners.com>
Wed, 10 Jul 2019 16:11:53 +0000 (18:11 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Wed, 10 Jul 2019 16:11:53 +0000 (18:11 +0200)
app/Models/Page.php
app/Providers/AppServiceProvider.php
resources/styles/components/contact-details.styl
resources/views/components/intro-block.blade.php
resources/views/layouts/app.blade.php
resources/views/pages/contact.blade.php
resources/views/pages/home.blade.php
resources/views/pages/solution.blade.php
resources/views/partials/footer.blade.php

index 28ef8954872decd1da036e3e92a17411086e5a3e..f2fc9bb71a07df92fe79a781572947c5b91b4790 100644 (file)
@@ -6,15 +6,5 @@ use Cubist\Backpack\app\Magic\Models\CMSPage;
 
 class Page extends CMSPage
 {
-    function getImages($collectionName) {
-        return $this->getMedia($collectionName);
-    }
 
-    function getImage($collectionName) {
-        return $this->getImages($collectionName)->first();
-    }
-
-    function getImageURL($collectionName) {
-        return $this->getImage($collectionName)->getUrl();
-    }
 }
index 4e44bc47fe76bd7f87f452706f77ca8bbf22f589..d16f283277611eb428f177e52e0161f8a1467d05 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\Providers;
 
 use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\View;
 use Spatie\BladeX\Facades\BladeX;
 
 class AppServiceProvider extends ServiceProvider
@@ -24,6 +25,13 @@ class AppServiceProvider extends ServiceProvider
      */
     public function boot()
     {
+        // Make current view name available to all views (used for body class)
+        View::composer('*', function ($view) {
+            $view_parts = explode('.', $view->getName());
+            $view_name = end($view_parts);
+            View::share('view_name', $view_name);
+        });
+
         try {
             // BladeX Component Aliases
             // Ref: https://docs.spatie.be/laravel-blade-x/v2/introduction
index 9a935411fd3dc4c93ed7701eb9fb80dcbd097dfe..45b27bccc030a780af4d4779ed0e7eed0a43d0ba 100644 (file)
         transform: scale(1.1)
 
   &-icon
-    @apply mr-4
+    @apply mr-4 text-navy
     transform: scale(1)
     transition: transform 0.1s ease-out
 
   &-title
-    @apply font-display
+    @apply font-bold font-body text-navy
 
-// Contact page overrides
-.contact-page
+// Footer overrides
+.footer
   .contact-details
     &-icon
-      @apply text-navy
+      @apply text-inherit
     &-title
-      @apply font-bold font-body text-navy
+      @apply text-inherit font-display
 
index 5d877b4cb878b31940fbfe352959f9fe9931b736..01c4d0008d239bfc9984d134088798cd51904cd8 100644 (file)
@@ -9,8 +9,8 @@
 <full-width :padding="$padding" :class="$class">
     <content>
         <columns>
-            {{-- Image sticks  --}}
-            <column class="md:-ml-2v sm:-mr-2v">
+            {{-- Image sticks to sides on medium and small screens --}}
+            <column class="md:-ml-2v sm:-mr-2v sm:mb-0">
                 @if ($image)
                     <img src="{{ $image }}" alt="{{ $title }}">
                 @endif
@@ -19,6 +19,9 @@
             <column>
                 <text-block class="pt-2v" title-class="h1 overlap-left" :title="$title">
                     {{ $slot }}
+
+                    {{-- Todo: handle button / link here? Also consider if data should be passed as individual params or just the whole $intro object? --}}
+
                 </text-block>
             </column>
         </columns>
index 26b3def09c180f939c8e8a2885ad1ec445c7661b..115599d40d41ef55e29c28cea29669b2d1aa8021 100644 (file)
@@ -8,7 +8,7 @@
     <link href="{{ mix('css/app.css') }}" rel="stylesheet">
     <link href="https://fonts.googleapis.com/css?family=Barlow:500,600|Muli:400,700&display=swap" rel="stylesheet">
 </head>
-<body class="font-body text-grey-dark">
+<body class="template-{{ $view_name }} {{ $body_class ?? '' }} font-body text-grey-dark">
 @include('cubist::body.begin')
 
 
index 0678582b9cd84a2d52993afd95a380f50fb41863..11be5fb1c190a679521f87ccae5b0110814b0351 100644 (file)
@@ -2,45 +2,45 @@
 
 @section('content')
 
-    <div class="contact-page">
-
-        <intro-block padding="pb-2v" :title="$page->intro->title ?? ''" :image="$model->getImageURL($page->intro->image)">
-            <p>{!! nl2br($page->intro->text) !!}</p>
-            <p><a href="#">{{ $page->intro->button->label }}</a></p>
-        </intro-block>
-
-        <full-width padding="pb-4v">
-            <content>
-                <columns>
-                    <column>
-                        <text-block>
-
-                            <h2 class="h2">{{ __('Coordonnées') }}</h2>
-                            @include('partials.contact-details')
-
-                            <h2 class="h2 mt-10">{{ __('Suivez-nous') }}</h2>
-
-                            {{-- Social Networks --}}
-                            {{-- Todo: consider refactoring social data structure so image, label and URL can be set from admin --}}
-                            <a class="flex items-center mb-4 font-bold text-navy hover:text-blue" href="{{ $global->social->twitter }}" target="_blank" rel="noopener">
-                                @svg('icon-twitter', 'mr-3')
-                                {{ __('Twitter') }}
-                            </a>
-
-                            <a class="flex items-center mb-4 font-bold text-navy hover:text-blue" href="{{ $global->social->linkedin }}" target="_blank" rel="noopener">
-                                @svg('icon-linkedin', 'mr-3')
-                                {{ __('LinkedIn') }}
-                            </a>
-
-                        </text-block>
-
-                    </column>
-                    <column class="bg-grey-200 p-10 text-center">
-                        (contact form)
-                    </column>
-                </columns>
-            </content>
-        </full-width>
-
-    </div>
+    <intro-block padding="pb-2v"
+                 :title="$page->get('intro.title')"
+                 :image="$page->getImageURL('intro.image')"
+                 :button="$page->get('intro.button')">
+        <p>{!! nl2br($page->get('intro.text')) !!}</p>
+    </intro-block>
+
+    <full-width padding="pb-4v">
+        <content>
+            <columns>
+                <column>
+                    <text-block>
+
+                        <h2 class="h2">{{ __('Coordonnées') }}</h2>
+                        @include('partials.contact-details')
+
+                        <h2 class="h2 mt-10">{{ __('Suivez-nous') }}</h2>
+
+                        {{-- Social Networks --}}
+                        {{-- Todo: consider refactoring social data structure so image, label and URL can be set from admin --}}
+                        <a class="flex items-center mb-4 font-bold text-navy hover:text-blue" href="{{ $global->get('social.twitter') }}" target="_blank" rel="noopener">
+                            @svg('icon-twitter', 'mr-3')
+                            {{ __('Twitter') }}
+                        </a>
+
+                        <a class="flex items-center mb-4 font-bold text-navy hover:text-blue" href="{{ $global->get('social.linkedin') }}" target="_blank" rel="noopener">
+                            @svg('icon-linkedin', 'mr-3')
+                            {{ __('LinkedIn') }}
+                        </a>
+
+                    </text-block>
+
+                </column>
+                <column class="bg-grey-200 p-10 text-center">
+                    (contact form)
+                </column>
+            </columns>
+        </content>
+    </full-width>
+
+
 @endsection
index aef8e88e898df5edf1a739b7c071a55137e7fb59..066ff399f2ad6c8c6e041ee26e438efd37d0d150 100644 (file)
     </full-width>
 
     {{-- Intro text --}}
-    <intro-block padding="pt-5v pb-4v" :title="$page->intro->title" :image="asset('storage/uploads/images/home-wing.jpg')">
+    <intro-block padding="pt-5v pb-4v" :title="$page->get('intro.title')" :image="$page->getImageURL('intro.image')">
         {{-- Todo: make a better function for converting plain text into paragraphs and breaks --}}
-        <p>{!! nl2br($page->intro->text) !!}</p>
+        <p>{!! nl2br($page->get('intro.text')) !!}</p>
 
         {{-- Todo: make a component for handling CMS links when passing an object like $page->intro->button --}}
-        <p><a href="#">{{ $page->intro->button->label }}</a></p>
+        <p><a href="#">{{ $page->get('intro.button.label') }}</a></p>
     </intro-block>
 
 
     </full-width>
 
     {{-- Services & Support --}}
-    <intro-block class="bg-grey-100" :title="__('Services & Support')" :image="asset('storage/uploads/images/home-services.jpg')">
-        <p>PM instrumentation distribue depuis 1986 des Capteurs et Systèmes de haute technicité. 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>
-
-        <p>Principalement dédiés aux mesures physiques, nous saurons vous conseiller dans le choix de produits adaptés à votre environnement.</p>
-
-        <p><a href="#">En savoir plus</a></p>
+    <intro-block class="bg-grey-100"
+                 :title="$page->get('services_support.title')"
+                 :image="$page->getImageURL('services_support.image')"
+                 :button="$page->get('services_support.button')">
+        <p>{!! nl2br($page->get('services_support.text')) !!}</p>
     </intro-block>
 
     {{-- News --}}
index d6740229309207d15b62f9b01a925bdd3902bb4d..092dbddea72985c1ce3cf6098251385612ba28fe 100644 (file)
@@ -2,7 +2,7 @@
 
 @section('content')
 
-    <intro-block padding="pb-4v" :title="$page->get('intro.title')" :image="asset('storage/uploads/images/home-wing.jpg')">
+    <intro-block padding="pb-4v" :title="$page->get('intro.title')" :image="$page->getImageURL('intro.image')">
         <p>{!! nl2br($page->get('intro.text')) !!}</p>
         <p><a href="#">{{ $page->get('intro.button.label') }}</a></p>
     </intro-block>
index c308196cb8fde062cdbab4c742afc19742b7f259..ff30237b1976010e947d329866b25e5fe1ebd5d4 100644 (file)
@@ -52,7 +52,7 @@
                 </span>
                 <div class="footer-locales-list-wrapper">
                     <ul class="footer-locales-list">
-                        <li><a href="/de"><img src="{{ asset('images/locale-de.svg') }}" alt="Deutsch" class="footer-locales-flag">Deutsche</a></li>
+                        <li><a href="/de"><img src="{{ asset('images/locale-de.svg') }}" alt="Deutsch" class="footer-locales-flag">Deutsch</a></li>
                         <li><a href="/en"><img src="{{ asset('images/locale-en.svg') }}" alt="English" class="footer-locales-flag">English</a></li>
                     </ul>
                 </div>