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();
- }
}
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
+use Illuminate\Support\Facades\View;
use Spatie\BladeX\Facades\BladeX;
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
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
<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
<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>
<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')
@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
</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 --}}
@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>
</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>