Skip to content
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
3,745 changes: 2,152 additions & 1,593 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"render": "file:./render.php"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
*/
import { __ } from '@wordpress/i18n';
import { useBlockProps, RichText, InspectorControls } from '@wordpress/block-editor';
import {
useBlockProps,
RichText,
InspectorControls,
} from '@wordpress/block-editor';
import { PanelBody, SelectControl, Spinner } from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
Expand All @@ -14,10 +18,22 @@ export default function Edit( { attributes, setAttributes } ) {
const { heading, featuredExpertId } = attributes;

const { experts, hasResolvedExperts } = useSelect( ( select ) => {
const query = { per_page: -1, status: 'publish', orderby: 'title', order: 'asc' };
const query = {
per_page: -1,
status: 'publish',
orderby: 'title',
order: 'asc',
};
return {
experts: select( coreStore ).getEntityRecords( 'postType', 'experts', query ),
hasResolvedExperts: select( coreStore ).hasFinishedResolution( 'getEntityRecords', [ 'postType', 'experts', query ] ),
experts: select( coreStore ).getEntityRecords(
'postType',
'experts',
query
),
hasResolvedExperts: select( coreStore ).hasFinishedResolution(
'getEntityRecords',
[ 'postType', 'experts', query ]
),
};
}, [] );

Expand All @@ -38,7 +54,11 @@ export default function Edit( { attributes, setAttributes } ) {
label={ __( 'Featured expert', 'mitlib-blocks' ) }
value={ featuredExpertId }
options={ expertOptions }
onChange={ ( value ) => setAttributes( { featuredExpertId: Number( value ) } ) }
onChange={ ( value ) =>
setAttributes( {
featuredExpertId: Number( value ),
} )
}
/>
) : (
<Spinner />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/**
* Server-side rendering for the featured and events section block.
*
* @package MITlib Blocks
* @var array $attributes Block attributes.
* @var string $content Block default content.
* @var WP_Block $block Block instance.
Expand Down Expand Up @@ -41,9 +42,9 @@
$expert_excerpt = $default_expert['excerpt'];
}

// Generate the strings for alt text and help link text
$expert_alt_text = "Headshot of " . $expert_name;
$expert_help_link_text = "How can " . $expert_first_name . " help you?";
// Generate the strings for alt text and help link text.
$expert_alt_text = 'Headshot of ' . $expert_name;
$expert_help_link_text = 'How can ' . $expert_first_name . ' help you?';

?><section id="featured-and-events">
<div class="content-wrapper">
Expand Down Expand Up @@ -130,7 +131,7 @@
$news_site_id = 4;
switch_to_blog( $news_site_id );

$today = date( 'Ymd' );
$today = gmdate( 'Ymd' );

$events_args = array(
'posts_per_page' => 20,
Expand Down Expand Up @@ -159,7 +160,7 @@
$events_query->the_post();
$custom = get_post_custom();

if ( ! isset( $custom['is_event'][0] ) || $custom['is_event'][0] !== '1' ) {
if ( ! isset( $custom['is_event'][0] ) || '1' !== $custom['is_event'][0] ) {
continue;
}

Expand All @@ -178,7 +179,7 @@
'excerpt' => get_the_excerpt(),
);

if ( ! empty( $custom['pin_event_on_homepage'][0] ) && $custom['pin_event_on_homepage'][0] === '1' ) {
if ( ! empty( $custom['pin_event_on_homepage'][0] ) && '1' === $custom['pin_event_on_homepage'][0] ) {
$featured_events[] = $event_data;
} else {
$regular_events[] = $event_data;
Expand All @@ -191,9 +192,12 @@
$display_events = array_slice( $featured_events, 0, 2 );
} elseif ( count( $featured_events ) === 1 ) {
$display_events = array_merge( $featured_events, array_slice( $regular_events, 0, 1 ) );
usort( $display_events, function ( $a, $b ) {
return strcmp( $a['event_date'], $b['event_date'] );
} );
usort(
$display_events,
function ( $a, $b ) {
return strcmp( $a['event_date'], $b['event_date'] );
}
);
} else {
$display_events = array_slice( $regular_events, 0, 2 );
}
Expand Down Expand Up @@ -245,7 +249,7 @@
<p>Check back later or <a href="/news/subscribe">sign up for our newsletter</a> to stay on top of new events</p>
</div>

<?php
<?php
}

restore_current_blog();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* React hook that is used to mark the block wrapper element.
* It provides all the necessary props like the class name.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
*/
import { useBlockProps } from '@wordpress/block-editor';

/**
* The save function defines the way in which the different attributes should
* be combined into the final markup, which is then serialized by the block
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@
"textdomain": "mitlib-blocks",
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js"
"style": "file:./style-index.css"
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
/**
* Retrieves the translation of text.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-i18n/
*/
import { __ } from '@wordpress/i18n';
/**
* React hook that is used to mark the block wrapper element.
* It provides all the necessary props like the class name.
Expand Down Expand Up @@ -31,6 +25,6 @@ export default function Edit() {
return (
<div { ...useBlockProps() }>
<h2>Featured collection (No title to edit)</h2>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* React hook that is used to mark the block wrapper element.
* It provides all the necessary props like the class name.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
*/
import { useBlockProps } from '@wordpress/block-editor';

/**
* The save function defines the way in which the different attributes should
* be combined into the final markup, which is then serialized by the block
Expand All @@ -18,16 +10,36 @@ import { useBlockProps } from '@wordpress/block-editor';
export default function save() {
return (
<section id="featured-collection">
<div class="content-wrapper">
<div class="featured-collection-image" role="img" aria-label="Architectural elevation of a house with two gables and two chimneys by Howe, Manning and Almy Architects, dated 1927." style="background-image: url('https://libraries.mit.edu/app/uploads/2026/07/Howe-Manning-Almy-1.jpg');">
<span class="featured-collection-tag">Exhibit</span>
<div className="content-wrapper">
<div
className="featured-collection-image"
role="img"
aria-label="Architectural elevation of a house with two gables and two chimneys by Howe, Manning and Almy Architects, dated 1927."
style="background-image: url('https://libraries.mit.edu/app/uploads/2026/07/Howe-Manning-Almy-1.jpg');"
>
<span className="featured-collection-tag">Exhibit</span>
</div>
<div class="featured-collection-content">
<h2 class="sr">Featured Exhibit</h2>
<p class="eyebrow">Howe, Manning & Almy</p>
<h3>Boston's First All-Woman Firm and the Changing Face of Architecture</h3>
<p>Learn about the role MIT's architecture program played in supporting women in the field since the 1890s, Howe, Manning & Almy's influence on the built environment of Cambridge, and the firm's ecofriendly approaches to renovation.</p>
<a class="button secondary" title="Read more about the Howe, Manning & Almy exhibit" href="https://libraries.mit.edu/exhibits/exhibit/howe-manning-almy/">Check it out</a>
<div className="featured-collection-content">
<h2 className="sr">Featured Exhibit</h2>
<p className="eyebrow">Howe, Manning & Almy</p>
<h3>
Boston&apos;s First All-Woman Firm and the Changing Face
of Architecture
</h3>
<p>
Learn about the role MIT&apos;s architecture program
played in supporting women in the field since the 1890s,
Howe, Manning & Almy&apos;s influence on the built
environment of Cambridge, and the firm&apos;s
ecofriendly approaches to renovation.
</p>
<a
className="button secondary"
title="Read more about the Howe, Manning & Almy exhibit"
href="https://libraries.mit.edu/exhibits/exhibit/howe-manning-almy/"
>
Check it out
</a>
</div>
</div>
</section>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
"editorScript": "file:./index.js",
"editorStyle": "file:./index.css",
"style": "file:./style-index.css",
"viewScript": "file:./view.js",
"render": "file:./render.php"
}
22 changes: 11 additions & 11 deletions web/app/plugins/mitlib-blocks/blocks/hero-section/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import { useBlockProps, RichText } from '@wordpress/block-editor';
import './editor.scss';

export default function Edit( { attributes, setAttributes } ) {
const blockProps = useBlockProps();
const blockProps = useBlockProps();

return (
<div { ...blockProps }>
<RichText
tagName="h1"
value={ attributes.heading }
onChange={ ( heading ) => setAttributes( { heading } ) }
placeholder={ __( 'Enter heading…', 'mitlib-blocks' ) }
/>
</div>
);
return (
<div { ...blockProps }>
<RichText
tagName="h1"
value={ attributes.heading }
onChange={ ( heading ) => setAttributes( { heading } ) }
placeholder={ __( 'Enter heading…', 'mitlib-blocks' ) }
/>
</div>
);
}
2 changes: 2 additions & 0 deletions web/app/plugins/mitlib-blocks/blocks/hero-section/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
/**
* Server-side rendering for the hero section block.
*
* @package MITlib Blocks
* @var array $attributes Block attributes.
* @var string $content Block default content.
* @var WP_Block $block Block instance.
*/

?><section id="hero" role="img" aria-label="Two notebooks opened to show yellow graph paper; the top one has a black and white photo of a boat crew, and the bottom one shows handwritten text." style="background-image: url(https://libraries.mit.edu/app/uploads/2026/07/hero-image-edgerton.png);">
<div class="overlay">
<div class="content-wrapper">
Expand Down
10 changes: 1 addition & 9 deletions web/app/plugins/mitlib-blocks/blocks/hero-section/save.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/**
* React hook that is used to mark the block wrapper element.
* It provides all the necessary props like the class name.
*
* @see https://developer.wordpress.org/block-editor/reference-guides/packages/packages-block-editor/#useblockprops
*/
import { useBlockProps } from '@wordpress/block-editor';

/**
* The save function defines the way in which the different attributes should
* be combined into the final markup, which is then serialized by the block
Expand All @@ -16,5 +8,5 @@ import { useBlockProps } from '@wordpress/block-editor';
* @return {Element} Element to render.
*/
export default function save() {
return null;
return null;
}
25 changes: 0 additions & 25 deletions web/app/plugins/mitlib-blocks/blocks/hero-section/view.js

This file was deleted.

Loading
Loading