Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/homepage rows email subscriber #619

Merged
merged 6 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions app/Http/Controllers/homeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ public function index(): View
{
return view('home.index', [
'carousel' => Carousels::findBySection('home'),
'news' => NewsArticles::feature(),
'research' => ResearchProjects::listSimple('?', 3),
'objects' => Highlights::homeList(),
'things' => ThingsToDo::list(),
'fundraising' => FundRaising::list(4),
'thirdRow' => HomePage::returnThirdRow(),
'fourthRow' => HomePage::returnFourthRow(),
// 'news' => NewsArticles::feature(),
// 'research' => ResearchProjects::listSimple('?', 3),
// 'objects' => Highlights::homeList(),
// 'things' => ThingsToDo::list(),
// 'fundraising' => FundRaising::list(4),
'shopify' => Shopify::list(),
'galleries' => Galleries::list(3, '?', 'Open'),
'exhibitions' => Exhibitions::listHome('current', 'tessitura_string', 3),
Expand Down
120 changes: 120 additions & 0 deletions app/Models/HomePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,124 @@ public static function find(): array
// dd($api->getData());
return $api->getData()['data'][0];
}

/**
* @return array
* This method returns the data for the third row of the home page (Discover our collection, Explore our events, Research)
* This data is hardcoded because in not in the CMS
*/
public static function returnThirdRow() : array {
$thirdRowData['data'] = [
[
'image_alt_text' => '',
'title' => 'Discover our collection',
'image' => [
'data' => [
'thumbnails' => [
13 => [
'url' => 'https://content.fitz.ms/fitz-website/assets/large_PD_8_1979_1_201709.jpg?key=exhibition',
'width' => 416,
'height' => 416
]
]
]
],
'slug' => '/explore-our-collection',
],
[
'image_alt_text' => '',
'title' => 'Explore our events',
'image' => [
'data' => [
'thumbnails' => [
13 => [
'url' => 'https://content.fitz.ms/fitz-website/assets/img_20190105_153947.jpg?key=exhibition',
'width' => 416,
'height' => 416
]
]
]
],
'slug' => '/events',
],
[
'image_alt_text' => '',
'title' => 'Research',
'image' => [
'data' => [
'thumbnails' => [
13 => [
'url' => 'https://content.fitz.ms/fitz-website/assets/XRF%20analysis%20of%20an%20illuminated%20mss%20at%20the%20Fitz.jpg?key=exhibition',
'width' => 416,
'height' => 416
]
]
]
],
'slug' => '/research',
]
];
return $thirdRowData;
}

/**
* @return array
* This method returns the data for the fourth row of the home page (Plan your visit, Browse our shop, Support us)
* This data is hardcoded because in not in the CMS
*/
public static function returnFourthRow() : array {
$fourthRowData['data'] = [
[
'image_alt_text' => '',
'title' => 'Plan your visit',
'image' => [
'data' => [
'thumbnails' => [
13 => [
'url' => 'https://content.fitz.ms/fitz-website/assets/european-pottery-bond.jpg?key=exhibition',
'width' => 416,
'height' => 416
]
]
]
],
'slug' => '/plan-your-visit',
],
[
'image_alt_text' => '',
'title' => 'Browse our shop',
'image' => [
'data' => [
'thumbnails' => [
13 => [
'url' => 'https://content.fitz.ms/fitz-website/assets/Courtyard%20(2)%20(1).jpg?key=exhibition',
'width' => 416,
'height' => 416,
]
]
]
],
'slug' => 'https://curatingcambridge.co.uk/collections/the-fitzwilliam-museum',
],
[
'image_alt_text' => '',
'title' => 'Support us',
'image' => [
'data' => [
'thumbnails' => [
13 => [
'url' => 'https://content.fitz.ms/fitz-website/assets/happy_faces_scholars_reception_optimised.jpg?key=exhibition',
'width' => 416,
'height' => 416
]
]
]
],
'slug' => '/support-us',
]
];

return $fourthRowData;

}
}
2 changes: 1 addition & 1 deletion public/css/fitzwilliam.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=3279ab0dbb55afbe7580f7801ccb6d89",
"/css/app.css": "/css/app.css?id=d79638d6f63d8085a92d95d25dcf9862",
"/css/fitzwilliam.css": "/css/fitzwilliam.css?id=91e8fd48d58aec5977a20d817b382575"
"/css/fitzwilliam.css": "/css/fitzwilliam.css?id=3c2d7525872b0ed4d4cf3320335dab2a"
}
56 changes: 56 additions & 0 deletions resources/css/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,59 @@ a.text-center.btn.btn-outline-light.btn__book {
.acknowledgement-highlights-form .form-field{
display: flex;
}

.bg-white-subscribe {
padding: 28px 16px 24px;
}

.container-subscribre {
max-width: 1290px;
background-color: #B50E5E !important;
border-radius: 4px;
padding: 20px;
color: white;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 24px;
}

.container-subscribre .wrapper h5 {
font-size: 24px;
font-weight: 500;
}

.container-subscribre .wrapper p {
font-size: 18px;
font-weight: 400;
margin: 0;
}
.container-subscribre .subscribre-button {
margin-top: 8px;
margin-right: auto;
padding: 16px;
background: black;
display: inline-flex;
align-items: center;
color: #fff;
border-radius: 4px;
font-size: 20px;
font-weight: 500;
white-space: nowrap;
}
.container-subscribre .subscribre-button svg {
margin-right: 8px;
}

@media screen and (min-width: 756px) {
.container-subscribre {
flex-direction: row;
align-items: center;
}
.container-subscribre .subscribre-button {
margin-top: 0;
margin-left: auto;
margin-right: 0
}
}
18 changes: 15 additions & 3 deletions resources/views/components/image-home-card.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
<?php

$urlLink = '';

if('custom' === $route) {
$urlLink = $params[0];
} else {
$urlLink = route($route, $params);
}

?>

<div class="col-md-4 mb-3 container-home-card">
<div class="card card-fitz h-100">
@isset($image)
<a href="{{ route($route, $params) }}">
<a href="{{ $urlLink }}">
<img class="card-img-top"
src="{{ $image['data']['thumbnails'][13]['url']}}"
alt="{{ $altTag }}"
Expand All @@ -11,7 +23,7 @@
/>
</a>
@else
<a href="{{ route($route, $params) }}">
<a href="{{ $urlLink }}">
<img class="card-img-top"
src="{{ env('MISSING_IMAGE_URL') }}"
alt="A stand in image for {{ $title }}"
Expand All @@ -22,7 +34,7 @@
<div class="card-body h-100">
<div class="contents-label mb-3">
<h2>
<a href="{{ route($route, $params) }}" class="stretched-link">
<a href="{{ $urlLink }}" class="stretched-link">
{{ $title }}
</a>
</h2>
Expand Down
38 changes: 17 additions & 21 deletions resources/views/exhibitions/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
@section('current')
<div class="container-fluid py-3 bg-gdbo">
<div class="container">
@if(!empty($current['data']))

<h3>Our current exhibitions</h3>
@if(!empty($current['data']) && !empty($displays['data']))
ostafinskim marked this conversation as resolved.
Show resolved Hide resolved
<h3>Current exhibitions and displays</h3>
<div class="row">
@foreach($current['data'] as $current)
<x-exhibition-card
Expand All @@ -32,36 +31,33 @@
:tessitura="$current['tessitura_string']"
:copyright="$current['copyright_text']"></x-exhibition-card>
@endforeach
</div>
@endif
@if(!empty($displays['data']))
<h3 id="displays">Exhibitions and displays</h3>
<div class="row">

@foreach($displays['data'] as $display)
<x-exhibition-card
:altTag="$display['hero_image_alt_text']"
:title="$display['exhibition_title']"
:image="$display['hero_image']"
:route="'exhibition'"
:params="[$display['slug']]"
:startDate="$display['exhibition_start_date']"
:endDate="$display['exhibition_end_date']"
:status="'current'"
:ticketed="$display['ticketed']"
:tessitura="$display['tessitura_string']"
:copyright="$display['copyright_text']"></x-exhibition-card>
<x-exhibition-card
:altTag="$display['hero_image_alt_text']"
:title="$display['exhibition_title']"
:image="$display['hero_image']"
:route="'exhibition'"
:params="[$display['slug']]"
:startDate="$display['exhibition_start_date']"
:endDate="$display['exhibition_end_date']"
:status="'current'"
:ticketed="$display['ticketed']"
:tessitura="$display['tessitura_string']"
:copyright="$display['copyright_text']"></x-exhibition-card>
@endforeach
</div>
@endif
</div>
</div>
@endsection

@if(!empty($future['data'] ))
@section('future')
<div class="container-fluid py-3 bg-grey">

<div class="container">
<h3>Forthcoming exhibitions and displays</h3>
<h3>Upcoming exhibitions and displays</h3>
<div class="row">
@foreach($future['data'] as $future)

Expand Down
40 changes: 32 additions & 8 deletions resources/views/home/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,31 @@
<x-home-page-hero :hero="$hero"></x-home-page-hero>
@endSection

@section('news')
@section('custom-third-row')
@foreach ( $thirdRow['data'] as $item )
<x-image-home-card
:altTag="$item['image_alt_text']"
:title="$item['title']"
:image="$item['image']"
:route="'custom'"
:params="[$item['slug']]"
></x-image-home-card>
@endforeach
@endsection

@section('custom-fourth-row')
@foreach ( $fourthRow['data'] as $item )
<x-image-home-card
:altTag="$item['image_alt_text']"
:title="$item['title']"
:image="$item['image']"
:route="'custom'"
:params="[$item['slug']]"
></x-image-home-card>
@endforeach
@endsection

{{-- @section('news')
@foreach($news['data'] as $news)
<x-image-home-card
:altTag="$news['field_image_alt_text']"
Expand All @@ -24,9 +48,9 @@
:route="'article'"
:params="[$news['slug']]"></x-image-home-card>
@endforeach
@endsection
@endsection --}}

@section('fundraising')
{{-- @section('fundraising')
<div class="container container-home-cards">
<h3><a href="{{ route('landing', 'support-us') }}">Support us</a></h3>
<div class="row row-home">
Expand All @@ -35,9 +59,9 @@
@endforeach
</div>
</div>
@endsection
@endsection --}}

@section('research')
{{-- @section('research')
@foreach($research['data'] as $project)
<x-image-home-card
:altTag="$project['hero_image_alt_text']"
Expand All @@ -46,9 +70,9 @@
:route="'research-project'"
:params="[$project['slug']]"></x-image-home-card>
@endforeach
@endsection
@endsection --}}

@section('themes')
{{-- @section('themes')
@foreach($objects['data'] as $theme)
<x-image-home-card
:altTag="$theme['image_alt_text']"
Expand All @@ -57,7 +81,7 @@
:route="'highlight'"
:params="[$theme['slug']]"></x-image-home-card>
@endforeach
@endsection
@endsection --}}

@if(!empty($shopify))
@section('shopify')
Expand Down
Loading