Skip to content

Commit

Permalink
Merge pull request #693 from waynestate/feature/refactor-4
Browse files Browse the repository at this point in the history
Feature/refactor 4
  • Loading branch information
breakdancingcat committed Feb 1, 2024
2 parents 99a83e8 + 04e7bd5 commit 5e5211f
Show file tree
Hide file tree
Showing 31 changed files with 216 additions and 156 deletions.
1 change: 0 additions & 1 deletion app/Repositories/EventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function getEvents($site_id, $limit = 4)
'method' => 'calendar.events.listing',
'site' => $site_id,
'limit' => $limit,
'start_date' => date('Y-m-d', strtotime('+1 month')),
'end_date' => date('Y-m-d', strtotime('+6 month')),
];

Expand Down
19 changes: 17 additions & 2 deletions app/Repositories/ModularPageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function getModularComponents(array $data): array
}

$components = $this->parseData($data);
$promos = $this->getPromos($components);
$promos = $this->getPromos($components, $data['site']['id'] ?? '');

foreach($components['components'] as $name => $component) {
if(Str::startsWith($name, 'events')) {
Expand Down Expand Up @@ -196,7 +196,7 @@ public function parseData(array $data)
];
}

public function getPromos($components)
public function getPromos($components, $site_id)
{
$params = [
'method' => 'cms.promotions.listing',
Expand All @@ -209,6 +209,21 @@ public function getPromos($components)
return $this->wsuApi->sendRequest($params['method'], $params);
});

// TODO Allowing the use of another site's promo items only from base
if (!empty($site_id) && $site_id === 1561) {
$promos['promotions'] = collect($promos['promotions'])->map(function ($promo) {
if (!empty($promo['filename_url'])) {
$promo['relative_url'] = $promo['filename_url'];
}

if (!empty($promo['secondary_filename_url'])) {
$promo['secondary_relative_url'] = $promo['secondary_filename_url'];
}

return $promo;
})->toArray();
}

$promos = $this->parsePromos->parse($promos, $components['group_reference'], $components['group_config']);

foreach ($promos as $name => $data) {
Expand Down
16 changes: 16 additions & 0 deletions resources/scss/components/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,26 @@
@apply ml-8 list-disc;
}

ul ul {
@apply mb-0 list-circle;
}

ul ul ul {
@apply mb-0 list-square;
}

ol {
@apply ml-8 list-decimal;
}

ol ol {
@apply mb-0 list-lower-alpha;
}

ol ol ol {
@apply mb-0 list-lower-roman;
}

// Tailwind preflight sets images to block
img {
@apply inline;
Expand Down
12 changes: 7 additions & 5 deletions resources/views/childpage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@section('content')
@include('components.page-title', ['title' => $base['page']['title']])

@if(empty($components['page-content']))
@if(empty($components['page-content-row']) && empty($components['page-content-column']))
<div class="content">
{!! $base['page']['content']['main'] !!}
</div>
Expand All @@ -13,11 +13,13 @@
<div class="grid grid-cols-1 md:grid-cols-2 items-start gap-y-8 sm:gap-x-4 lg:gap-x-8 mt-8 mb-4">
@foreach($components as $componentName => $component)
@if(!empty($component['data']) && !empty($component['component']['filename']))
<div class="col-span-2 {{ str_contains($component['component']['filename'], 'column') ? 'md:col-span-1' : 'md:col-span-2' }}">
@if(!empty($component['component']['heading']))<h2 class="mt-0" id="{{ Str::slug($component['component']['heading']) }}">{{ $component['component']['heading'] }}</h2>@endif
@if(\View::exists('components/'.$component['component']['filename']))
<div class="col-span-2 {{ str_contains($component['component']['filename'], 'column') ? 'md:col-span-1' : 'md:col-span-2' }}">
@if(!empty($component['component']['heading']))<h2 class="mt-0" id="{{ Str::slug($component['component']['heading']) }}">{{ $component['component']['heading'] }}</h2>@endif

@include('components/'.$component['component']['filename'], ['data' => $component['data'], 'component' => $component['component']])
</div>
@include('components/'.$component['component']['filename'], ['data' => $component['data'], 'component' => $component['component']])
</div>
@endif
@endif
@endforeach
</div>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/hero/banner-large.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{--
$hero => array // ['filename_url', 'title']
$hero => array // ['relative_url', 'title']
--}}
<div class="hero__wrapper w-full">
<div class="hero__bg h-hero max-h-hero w-full bg-cover bg-center relative{{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['filename_url'] }}')" @else data-src="{{ $hero['filename_url'] }}"@endif></div>
<div class="hero__bg h-hero max-h-hero w-full bg-cover bg-center relative{{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['relative_url'] }}')" @else data-src="{{ $hero['relative_url'] }}"@endif></div>
</div>
4 changes: 2 additions & 2 deletions resources/views/components/hero/banner-small.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{--
$hero => array // ['filename_url', 'title']
$hero => array // ['relative_url', 'title']
--}}
<div class="hero__wrapper w-full">
<div class="hero__primary-image w-full h-hero-skinny max-h-hero-skinny bg-cover bg-center relative" style="background-image: url('{{ $hero['filename_url'] }}')"></div>
<div class="hero__primary-image w-full h-hero-small max-h-hero-small bg-cover bg-center relative" style="background-image: url('{{ $hero['relative_url'] }}')"></div>
</div>

4 changes: 2 additions & 2 deletions resources/views/components/hero/half.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{--
$hero => array // ['filename_url', 'title', 'description', 'link']
$hero => array // ['relative_url', 'title', 'description', 'link']
--}}

<div class="hero__wrapper w-full relative xl:flex items-center">
<div class="hero__primary-image w-full xl:w-[60%] shrink-0">
<div class="w-full aspect-video bg-center bg-cover{{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['filename_url'] }}')" @else data-src="{{ $hero['filename_url'] }}"@endif>
<div class="w-full aspect-video bg-center bg-cover{{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['relative_url'] }}')" @else data-src="{{ $hero['relative_url'] }}"@endif>
<span class="visually-hidden">{{ $hero['filename_alt_text'] }}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions resources/views/components/hero/logo-overlay.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{--
$hero => array // ['filename_url', 'title', 'description', 'link', 'secondary_filename_url']
$hero => array // ['relative_url', 'title', 'description', 'link', 'secondary_relative_url']
--}}

<div class="hero__wrapper w-full">
<div class="relative overflow-hidden flex bg-green-900 min-h-[500px]">
<div class="hero__primary-image inset-0 absolute print:relative bg-cover bg-top opacity-20 {{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['filename_url'] }}')" @else data-src="{{ $hero['filename_url'] }}"@endif></div>
<div class="hero__primary-image inset-0 absolute print:relative bg-cover bg-top opacity-20 {{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['relative_url'] }}')" @else data-src="{{ $hero['relative_url'] }}"@endif></div>
<div class="hero__content-position w-full relative text-white flex flex-col justify-center">
<div class="hero__content row w-full px-4 pt-10 pb-6 text-center content white-links">
@if(!empty($hero['secondary_filename_url']))<img class="hero__secondary-image mx-auto mb-4" src="{{ $hero['secondary_filename_url'] }}" alt="{{ $hero['secondary_alt_text'] }}">@endif
@if(!empty($hero['secondary_relative_url']))<img class="hero__secondary-image mx-auto mb-4" src="{{ $hero['secondary_relative_url'] }}" alt="{{ $hero['secondary_alt_text'] }}">@endif
<div class="hero__title md:drop-shadow-px leading-tight text-2xl mb-1 xl:text-5xl">
{{ $hero['title'] }}
</div>
Expand Down
6 changes: 3 additions & 3 deletions resources/views/components/hero/svg-overlay.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{{--
$hero => array // ['filename_url', 'title', 'link', 'secondary_filename_url']
$hero => array // ['relative_url', 'title', 'link', 'secondary_relative_url']
--}}

<div class="hero__wrapper w-full relative overflow-hidden">
@if(!empty($hero['link']))<a class="hero__link" href="{{ $hero['link'] }}">@endif
<div class="hero__primary-image pt-hero w-full bg-cover bg-top {{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['filename_url'] }}')" @else data-src="{{ $hero['filename_url'] }}"@endif></div>
<div class="hero__primary-image pt-hero w-full bg-cover bg-top {{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['relative_url'] }}')" @else data-src="{{ $hero['relative_url'] }}"@endif></div>
<div class="hero__content-position absolute print:relative inset-0 flex items-center justify-center">
<img class="hero__secondary-image w-full max-w-full max-h-full" src="{{ $hero['secondary_filename_url'] }}" alt="{{ $hero['secondary_alt_text'] }}">
<img class="hero__secondary-image w-full max-w-full max-h-full" src="{{ $hero['secondary_relative_url'] }}" alt="{{ $hero['secondary_alt_text'] }}">
</div>
@if(!empty($hero['link']))</a>@endif
</div>
4 changes: 2 additions & 2 deletions resources/views/components/hero/text-overlay.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{--
$hero => array // ['filename_url', 'title', 'description']
$hero => array // ['relative_url', 'title', 'description']
--}}

<div class="hero__wrapper w-full relative">
<div class="hero__primary-image h-hero max-h-hero w-full bg-cover bg-center relative{{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['filename_url'] }}')" @else data-src="{{ $hero['filename_url'] }}"@endif></div>
<div class="hero__primary-image h-hero max-h-hero w-full bg-cover bg-center relative{{ $loop->first !== true ? ' lazy' : '' }}" @if($loop->first === true) style="background-image: url('{{ $hero['relative_url'] }}')" @else data-src="{{ $hero['relative_url'] }}"@endif></div>
<div class="hero__content-position relative md:absolute print:relative md:bottom-0 md:inset-x-0 md:text-white md:white-links md:bg-gradient-darkest">
<div class="row">
<div class="hero__content relative p-4 pb-0 md:pb-2 md:pt-8 md:pt-20">
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/icons-column.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{--
$item => array // ['title', 'link', 'excerpt', 'filename_url', 'filename_alt_text']
$item => array // ['title', 'link', 'excerpt', 'relative_url', 'filename_alt_text']
--}}
<ul class="grid grid-cols-1 items-start gap-6 lg:gap-8 mt-2 mb-8 lg:my-8">
@foreach($data as $item)
<li>
<{{ !empty($item['link']) ? 'a href='.$item['link'] : 'div' }} class="flex items-start gap-x-4 {{ !empty($item['link']) ? 'group' : '' }}">
@image($item['filename_url'], $item['filename_alt_text'], 'grow-0 shrink-0 w-16')
@image($item['relative_url'], $item['filename_alt_text'], 'grow-0 shrink-0 w-16')
<div>
<div class="font-bold text-xl mt-0 mb-1 text-green no-underline group-hover:underline">{{ $item['title'] }}</div>
@if(!empty($item['excerpt']))<div class="text-sm text-black">{{ $item['excerpt'] }}</div>@endif
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/icons-row.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{--
$item => array // ['title', 'link', 'excerpt', 'filename_url', 'filename_alt_text']
$item => array // ['title', 'link', 'excerpt', 'relative_url', 'filename_alt_text']
--}}
<ul class="grid items-start gap-6 lg:gap-8 mt-2 mb-8 lg:my-8 md:grid-cols-2 lg:grid-cols-{{ !empty($component['columns']) && $component['columns'] >= 3 ? '3' : '2' }} xl:grid-cols-{{ !empty($component['columns']) ? $component['columns'] : '2' }}">
@foreach($data as $item)
<li>
<{{ !empty($item['link']) ? 'a href='.$item['link'] : 'div' }} class="flex items-start gap-x-4 {{ !empty($item['link']) ? 'group' : '' }}">
@image($item['filename_url'], $item['filename_alt_text'], 'grow-0 shrink-0 w-16 '.(!empty($component['columns']) && $component['columns'] >= 3 ? ' xl:w-16' : ' xl:w-20'))
@image($item['relative_url'], $item['filename_alt_text'], 'grow-0 shrink-0 w-16 '.(!empty($component['columns']) && $component['columns'] >= 3 ? ' xl:w-16' : ' xl:w-20'))
<div>
<div class="font-bold text-xl xl:text-2xl mt-0 mb-1 no-underline group-hover:underline">{{ $item['title'] }}</div>
@if(!empty($item['excerpt']))<div class="text-sm lg:text-base text-black">{{ $item['excerpt'] }}</div>@endif
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/icons-top-row.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{{--
$item => array // ['title', 'link', 'excerpt', 'filename_url', 'filename_alt_text']
$item => array // ['title', 'link', 'excerpt', 'relative_url', 'filename_alt_text']
--}}
<ul class="grid items-start gap-6 gap-y-2 lg:gap-8 lg:gap-y-4 grid-cols-2 lg:grid-cols-{{ !empty($component['columns']) && count($data) % 2 == 0 ? '2' : '3' }} xl:grid-cols-{{ !empty($component['columns']) ? $component['columns'] : '2' }}">
@foreach($data as $item)
<li>
<{{ !empty($item['link']) ? 'a href='.$item['link'] : 'div' }} class="text-center {{ !empty($item['link']) ? ' group' : '' }}">
@image($item['filename_url'], $item['filename_alt_text'], 'block mx-auto grow-0 shrink-0 mb-2 w-16'.(!empty($component['columns']) && $component['columns'] >= 5 ? ' xl:w-16' : ' xl:w-20'))
@image($item['relative_url'], $item['filename_alt_text'], 'block mx-auto grow-0 shrink-0 mb-2 w-16'.(!empty($component['columns']) && $component['columns'] >= 5 ? ' xl:w-16' : ' xl:w-20'))
<div>
<div class="font-bold text-xl mt-0 mb-1 no-underline group-hover:underline">{{ $item['title'] }}</div>
@if(!empty($item['excerpt']))<div class="text-sm text-black">{{ $item['excerpt'] }}</div>@endif
Expand Down
6 changes: 6 additions & 0 deletions resources/views/components/page-content-row.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{--
CMS page content
--}}
<div class="content">
{!! $base['page']['content']['main'] !!}
</div>
12 changes: 6 additions & 6 deletions resources/views/components/promo/grid-item.blade.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{{--
This component's image is 1/4 width on small views
$item => array // ['title', 'link', 'description', 'excerpt', 'filename_url', 'option']
$item => array // ['title', 'link', 'description', 'excerpt', 'relative_url', 'option']
--}}

<{{ !empty($item['link']) ? 'a href='.$item['link'] : 'div' }} class="block {{ !empty($component['gradientOverlay']) && $component['gradientOverlay'] === true ? 'bg-green-800 relative overflow-hidden' : '' }} {{ !empty($item['link']) ? 'group' : '' }} {{ $loop->last != true && !empty($component['filename']) && $component['filename'] != 'catalog' ? 'mt-6 mb-8' : '' }}">
<div class="{{ !empty($component['gradientOverlay']) ? '' : 'mb-2' }}">
@if(!empty($item['youtube_id']))
<div class="play-video-button">
@if(!empty($item['filename_url']))
@image($item['filename_url'], $item['filename_alt_text'], "lazy block w-full")
@if(!empty($item['relative_url']))
@image($item['relative_url'], $item['filename_alt_text'], "lazy block w-full")
@else
@image('//i.wayne.edu/youtube/'.$item['youtube_id'].'/max', $item['title'], "lazy block w-full")
@endif
</div>
@elseif(!empty($item['filename_url']))
@image($item['filename_url'], $item['filename_alt_text'], "lazy block w-full")
@elseif(!empty($item['relative_url']))
@image($item['relative_url'], $item['filename_alt_text'], "lazy block w-full")
@endif
</div>

<div class="w-full {{ !empty($component['gradientOverlay']) && $component['gradientOverlay'] === true ? 'bg-gradient-darkest absolute inset-x-0 bottom-0' : '' }}">
<div class="content {{ !empty($component['gradientOverlay']) && $component['gradientOverlay'] === true ? 'white-links text-white relative p-4 pt-20 drop-shadow-px' : '' }}">
@if(!empty($item['youtube_id']) || !empty($item['filename_url']))
@if(!empty($item['youtube_id']) || !empty($item['relative_url']))
<div class="my-1 font-bold {{ !empty($component['columns']) ? ($component['columns'] < 4 ? 'text-lg' : 'text-base') : 'text-xl' }} group-hover:underline group-focus:underline leading-snug xl:leading-tight">
{{ $item['title'] }}
</div>
Expand Down
14 changes: 7 additions & 7 deletions resources/views/components/promo/list-item.blade.php
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{{--
This component's image is full width on small views
$item => array // ['title', 'link', 'description', 'excerpt', 'filename_url', 'option']
$item => array // ['title', 'link', 'description', 'excerpt', 'relative_url', 'option']
--}}

<{{ !empty($item['link']) ? 'a href='.$item['link'] : 'div' }} class="block {{ !empty($component['imageSize']) && $component['imageSize'] === 'small' ? 'flex items-start' : 'md:flex xl:items-center' }} gap-x-3 lg:gap-x-6 {{ !empty($item['link']) ? 'group' : '' }} {{ $loop->iteration > 1 && !empty($component['filename']) && $component['filename'] != 'catalog' ? 'mt-6' : '' }}">
@if(!empty($item['youtube_id']) || !empty($item['filename_url']))
@if(!empty($item['youtube_id']) || !empty($item['relative_url']))
<div class="shrink-0 grow-0 {{ !empty($component['imageSize']) && $component['imageSize'] === 'small' ? 'w-1/4' : 'md:w-2/5' }}
@if(!empty($component['imagePosition']) && ($component['imagePosition'] === 'right' || ($component['imagePosition'] === 'alternate' && $loop->even))) md:order-2 @endif">
@if(!empty($item['youtube_id']))
<div class="play-video-button">
@if(!empty($item['filename_url']))
@image($item['filename_url'], $item['filename_alt_text'], "w-full lazy")
@if(!empty($item['relative_url']))
@image($item['relative_url'], $item['filename_alt_text'], "w-full lazy")
@else
@image('//i.wayne.edu/youtube/'.$item['youtube_id'].'/max', $item['title'], "w-full lazy")
@endif
</div>
@elseif(!empty($item['filename_url']))
@image($item['filename_url'], $item['filename_alt_text'], "lazy w-full")
@elseif(!empty($item['relative_url']))
@image($item['relative_url'], $item['filename_alt_text'], "lazy w-full")
@endif
</div>
@endif

<div class="content w-full">
@if(!empty($item['youtube_id']) || !empty($item['filename_url']))
@if(!empty($item['youtube_id']) || !empty($item['relative_url']))
<div class="mb-1 font-bold group-hover:underline group-focus:underline leading-tight text-lg lg:text-xl {{ !empty($component['imageSize']) && $component['imageSize'] === 'small' ? '' : 'mt-2 lg:mt-0' }}">{{ $item['title'] }}</div>
@elseif (!empty($component['heading']))
<h3 class="mt-0 mb-3 group-hover:underline group-focus:underline leading-tight">{{ $item['title'] }}</h3>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/components/spotlight-column.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{--
$data => array // ['title', 'excerpt', 'description', 'filename_url', 'filename_alt_text', 'link']
$data => array // ['title', 'excerpt', 'description', 'relative_url', 'filename_alt_text', 'link']
--}}
@foreach($data as $item)
<{{ !empty($item['link']) ? 'a href='.$item['link'] : 'div' }} class="{{ !empty($item['link']) ? 'group' : '' }}">
Expand All @@ -15,7 +15,7 @@
<div class="w-full flex items-center gap-x-2 mb-4">
<div class="w-20 lg:w-1/4 shrink-0">
<div class="rounded-full overflow-hidden w-full pt-full relative">
@image($item['filename_url'], $item['filename_alt_text'], 'block inset-0 absolute z-10 w-full h-full object-cover')
@image($item['relative_url'], $item['filename_alt_text'], 'block inset-0 absolute z-10 w-full h-full object-cover')
</div>
</div>
<cite class="not-italic">
Expand Down
Loading

0 comments on commit 5e5211f

Please sign in to comment.