Skip to content

Commit

Permalink
Merge branch 'release/8.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispelzer committed Sep 23, 2024
2 parents 8140802 + cc960f7 commit b730ba3
Show file tree
Hide file tree
Showing 36 changed files with 2,364 additions and 1,621 deletions.
22 changes: 18 additions & 4 deletions app/Http/Controllers/HomepageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\View\View;
use Illuminate\Http\Request;
use Contracts\Repositories\HomepageRepositoryContract;
use Contracts\Repositories\ModularPageRepositoryContract;
use Contracts\Repositories\EventRepositoryContract;
use Contracts\Repositories\ArticleRepositoryContract;

Expand All @@ -18,9 +19,14 @@ class HomepageController extends Controller
/**
* Construct the controller.
*/
public function __construct(HomepageRepositoryContract $promo, ArticleRepositoryContract $article, EventRepositoryContract $event)
{
public function __construct(
HomepageRepositoryContract $promo,
ModularPageRepositoryContract $modularComponent,
ArticleRepositoryContract $article,
EventRepositoryContract $event
) {
$this->promo = $promo;
$this->modularComponent = $modularComponent;
$this->article = $article;
$this->event = $event;
}
Expand All @@ -31,12 +37,20 @@ public function __construct(HomepageRepositoryContract $promo, ArticleRepository
public function index(Request $request): View
{
// $request->data['base']['show_site_menu'] = false;
// $promos = $this->promo->getHomepagePromos();

$promos = $this->promo->getHomepagePromos($request->data);

$modularComponents['modularComponents'] = [];

if(!empty($request->data['base']['data'])) {
$modularComponents['modularComponents'] = $this->modularComponent->getModularComponents($request->data['base']);
$promos['components'] = $modularComponents['modularComponents'];
}

$articles = $this->article->listing($request->data['base']['site']['news']['application_id']);

$events = $this->event->getEvents($request->data['base']['site']['id']);

return view('homepage', merge($request->data, $articles, $events));
return view('homepage', merge($request->data, $promos, $articles, $events));
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function show(Request $request): View
$fields = $this->profile->getFields();

// Change page title to profile name
$request->data['base']['page']['title'] = $this->profile->getPageTitleFromName($profile);
$request->data['base']['page']['title'] = $profile['profile']['full_name'] ?? '';
$request->data['base']['page']['canonical'] = $request->data['base']['server']['url'] ?? '';

// Set the back URL
Expand Down
4 changes: 2 additions & 2 deletions app/Repositories/HomepageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public function __construct(Connector $wsuApi, ParsePromos $parsePromos, Reposit
/**
* {@inheritdoc}
*/
public function getHomepagePromos(int $page_id = 0)
public function getHomepagePromos(array $data): array
{
$group_reference = [
123 => 'example',
];

$group_config = [
'example' => 'page_id:'.$page_id.'|randomize|first',
'example' => 'randomize|first',
];

$params = [
Expand Down
5 changes: 5 additions & 0 deletions app/Repositories/PeopleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function getProfiles(int $site_id, ?string $selected_group = null): array
}

$profile['data']['AccessID'] = $profile['accessid'];
$profile['full_name'] = $this->getPageTitleFromName(['profile' => $profile]);

$profile['groups'] = collect($profile['groups'])->keyBy('id')->toArray();

Expand Down Expand Up @@ -352,6 +353,10 @@ public function getFields()
*/
public function getPageTitleFromName($profile)
{
if (empty($profile)) {
return '';
}

$name_fields = $this->getFields()['name_fields'];

$name = collect($profile['profile']['data'])->filter(function ($value, $key) use ($name_fields) {
Expand Down
5 changes: 5 additions & 0 deletions app/Repositories/ProfileRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function getProfiles(int $site_id, ?string $selected_group = null): array
if (empty($profile_listing['error'])) {
$profile_listing = collect($profile_listing)->map(function ($item) {
$item['link'] = '/profile/'.$item['data']['AccessID'];
$item['full_name'] = $this->getPageTitleFromName(['profile' => $item]);

return $item;
})->toArray();
Expand Down Expand Up @@ -334,6 +335,10 @@ public function getFields()
*/
public function getPageTitleFromName($profile)
{
if (empty($profile)) {
return '';
}

$name_fields = $this->getFields()['name_fields'];

$name = collect($profile['profile']['data'])->filter(function ($value, $key) use ($name_fields) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/Repositories/HomepageRepositoryContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ interface HomepageRepositoryContract
/**
* {@inheritdoc}
*/
public function getHomepagePromos(int $page_id = 0);
public function getHomepagePromos(array $data): array;
}
12 changes: 11 additions & 1 deletion factories/AccordionItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,18 @@ public function create($limit = 1, $flatten = false, $options = [])
for ($i = 1; $i <= $limit; $i++) {
$data[$i] = [
'title' => $this->faker->sentence(),
'description' => '<p>'.$this->faker->paragraph().' <a href="/styleguide">Example link.</a></p>',
'description' => '<p>'.$this->faker->paragraph(5).' <a href="#">Example link.</a><ul><li>'.$this->faker->sentence.'</li><li>'.$this->faker->sentence.'</li><li>'.$this->faker->sentence.'</li></ul></p>',
'promo_item_id' => $this->faker->numberBetween(1000, 10000),
'relative_url' => $this->faker->randomElement([
'/styleguide/image/600x450?text=600x450', // 4:3
'/styleguide/image/450x600?text=450x600', // 3:4
'/styleguide/image/600x338?text=600x338', // 16:9
'/styleguide/image/600x600?text=600x600', // 1:1
'',
]),
'filename_alt_text' => 'Placeholder image '.$i,
'option' => $this->faker->randomElement(['Left','Right','Center','']),
'excerpt' => $this->faker->sentence,
];

$data[$i] = array_replace_recursive($data[$i], $options);
Expand Down
53 changes: 53 additions & 0 deletions factories/Catalog.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

namespace Factories;

use Contracts\Factories\FactoryContract;
use Faker\Factory;

class Catalog implements FactoryContract
{
/**
* Construct the factory.
*/
public function __construct(Factory $faker)
{
$this->faker = $faker->create();
}

/**
* {@inheritdoc}
*/
public function create($limit = 1, $flatten = false, $options = [])
{
// Doc https://github.com/fzaninotto/Faker

$promo_group_id = $this->faker->randomNumber(5);

$relative_url = '/styleguide/image/600x600?text=600x600'; // 1:1


for ($i = 0; $i <= $limit - 1; $i++) {
$data[$i] = [
'title' => 'Call to action',
'link' => '#',
'promo_item_id' => $i,
'promo_group_id' => strval($promo_group_id),
'relative_url' => $relative_url.':'.$i,
'filename_url' => $relative_url.':'.$i,
'filename_alt_text' => 'Placeholder image '.$i,
'group' => [
'title' => 'Modular Catalog Promotion Group',
],
];

$data[$i] = array_replace_recursive($data[$i], $options);
}

if ($limit === 1 && $flatten === true) {
return current($data);
}

return $data;
}
}
4 changes: 2 additions & 2 deletions factories/Flag.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public function create($limit = 1, $flatten = false, $options = [])
for ($i = 1; $i <= $limit; $i++) {
$data[$i] = [
'class' => 'flag',
'title' => 'Make a',
'title' => 'Make a <em>Gift</em>',
'link' => 'https://wayne.edu',
'excerpt' => 'Gift',
'excerpt' => '',
];

$data[$i] = array_replace_recursive($data[$i], $options);
Expand Down
17 changes: 17 additions & 0 deletions factories/People.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function create($limit = 1, $flatten = false, $options = [])
$accessid = $this->faker->randomLetter().$this->faker->randomLetter().$this->faker->randomNumber(4, true);
$first_name = $this->faker->firstName();
$last_name = $this->faker->lastName();
$suffix = $this->faker->suffix();
$email = $this->faker->email();
$title = $this->faker->sentence(3);
$picture = '/styleguide/image/600x800?text=600x800%20('.$i.')';
Expand Down Expand Up @@ -140,6 +141,7 @@ public function create($limit = 1, $flatten = false, $options = [])
$groups->random(),
],
'link' => '/styleguide/profile/aa0000',
'full_name' => $first_name . ' ' . $last_name,
'data' => [
'AccessID' => $accessid,
'First Name' => $first_name,
Expand All @@ -164,6 +166,21 @@ public function create($limit = 1, $flatten = false, $options = [])
],
];

// Randomly include a suffix
if (rand(0, 1) === 1) {
$data[$i]['suffix'] = $suffix;
$data[$i]['field_data'][] = [
'value' => $suffix,
'field' => [
'name' => 'Suffix',
'type' => 'text',
'global' => 1,
],
];
$data[$i]['data']['Suffix'] = $suffix;
$data[$i]['full_name'] = $first_name . ' ' . $last_name . ', ' . $suffix;
}

$data[$i] = array_replace_recursive($data[$i], $options);
}

Expand Down
5 changes: 5 additions & 0 deletions factories/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public function create($limit = 1, $flatten = false, $options = [])
'link' => '/styleguide/profile/aa0000',
];

// Randomly include a suffix
if (rand(0, 1) === 1) {
$data[$i]['data']['Suffix'] = $this->faker->suffix();
}

$data[$i] = array_replace_recursive($data[$i], $options);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "base",
"private": true,
"version": "8.10.6",
"version": "8.11.0",
"description": "",
"scripts": {
"dev": "npm run development",
Expand Down
94 changes: 63 additions & 31 deletions resources/scss/components/_flag.scss
Original file line number Diff line number Diff line change
@@ -1,41 +1,73 @@
.flag {
@apply absolute hidden mt:flex z-40 bg-gold text-green-800 hover:text-green-900 items-center justify-center mr-4 right-0 pt-0 duration-500;

transition-property: height, padding;
width: 140px;
height: 30px;

// Pointy bottom
&::after {
@apply border-gold absolute duration-500;

transition-property: top;
border-left-color: transparent;
border-right-color: transparent;
border-style: solid;
border-width: 12px 70px 0;
top: 30px;
content: "";
left: 0;
.flag__container {
.flag {
&__title {
@apply uppercase text-sm tracking-wide leading-3 relative z-50;
}

em,
&__excerpt {
@apply normal-case text-xl italic font-serif pl-0.5 leading-3;
}
}

&:hover {
@apply duration-500;
&.flag--sm {
@apply mx-4;

transition-property: height, padding;
height: 38px;
padding-top: 8px;
.flag {
@extend .gold-gradient-button;

&::after {
top: 38px;
@apply w-full font-normal mt:hidden;
}
}

&__title {
@apply uppercase text-sm tracking-wide pt-1.5 pt-1;
}
&.flag--mt {
@apply row relative;

.flag {
@apply absolute hidden mt:flex z-40 bg-gold text-green-800 hover:text-green-900 items-center justify-center mr-4 right-0 px-2 duration-500;

transition-property: height, padding;
min-width: 140px;
height: 28px;

&__container {
@apply row relative;
}

&__excerpt {
@apply normal-case text-xl italic font-serif pt-0.5 pl-1;
// Pointy bottom
&::after {
@apply bg-gold absolute duration-500;

clip-path: polygon(0 0, 100% 0, 100% 4%, 50% 14%, 0 4%);
//clip-path: polygon(0 0, 100% 0, 100% 12%, 50% 4%, 0 12%);
transition-property: top;
width: 100%;
height: 8rem;
top: 24px;
content: "";
left: 0;

/*
@apply border-gold absolute duration-500;
border-left-color: transparent;
border-right-color: transparent;
border-style: solid;
border-width: 12px 70px 0;
*/
}

&:hover {
@apply duration-500;

transition-property: height, padding;
height: 30px;
padding-top: 8px;

&::after {
top: 28px;
}
}
}
}
}
5 changes: 1 addition & 4 deletions resources/scss/components/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ figure {
}

figcaption {
@apply text-sm text-gray-500 text-left;

display: table-caption;
caption-side: bottom;
@apply text-sm text-green italic text-left mt-1 table-caption caption-bottom;
}

@screen mt {
Expand Down
Loading

0 comments on commit b730ba3

Please sign in to comment.