Skip to content

Commit

Permalink
Merge pull request #269 from yalesites-org/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
vinmassaro authored Sep 17, 2024
2 parents 84c2c9c + 341950c commit 532459d
Show file tree
Hide file tree
Showing 30 changed files with 299 additions and 14 deletions.
7 changes: 7 additions & 0 deletions atomic.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,10 @@ event-localist:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/02-molecules/meta/event-meta/event-meta-localist.js:
{}
chosen-select:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/01-atoms/forms/select/yds-select.js:
{}
dependencies:
- core/once
- libraries/chosen
14 changes: 14 additions & 0 deletions atomic.theme
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,17 @@ function atomic_preprocess_paragraph__accordion_item(&$variables) {
}
}
}

/**
* Implements hook_theme_suggestions_HOOK_alter() for field templates.
*/
function atomic_theme_suggestions_field_alter(array &$suggestions, array $variables) {
// Check if the field is attached to a node.
if ($variables['element']['#entity_type'] == 'node') {
$view_mode = $variables['element']['#view_mode'];
$field_name = $variables['element']['#field_name'];

// Add a theme suggestion for the field based on the parent node's view mode.
$suggestions[] = 'field__' . $variables['element']['#entity_type'] . '__' . $field_name . '__' . $view_mode;
}
}
12 changes: 12 additions & 0 deletions css/layout-builder.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ would be used instead resulting in top margin of size-spacing-6. */
margin-top: 0;
}

/* We allow spotlights in the banner now, but they appear a little to close to
* the top of the page. This allows us to adjust the top margin to give a
* little more space to just the first one.
*/
.main-content .layout--banner .layout__region > .text-with-image:first-child,
.main-content
.layout--banner
.layout__region
> .content-spotlight-portrait:first-child {
margin-top: var(--size-spacing-8);
}

/* The last item inside the `.main-content` area should have some space between
// it and the site footer (size-spacing-12 below) - unless it is designated as
// `$flush-bottom` above. Then it will have no bottom-margin separating it from
Expand Down
40 changes: 34 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@

{% embed "@molecules/content-spotlight-portrait/yds-content-spotlight-portrait.twig" with {
content_spotlight_portrait__heading: content.field_heading.0,
content_spotlight_portrait__heading_level: content.field_heading_level.0['#markup'],
content_spotlight_portrait__subheading: content.field_subheading.0,
content_spotlight_portrait__text: content.field_text,
content_spotlight_portrait__link__content: content.field_link.0['#title'],
content_spotlight_portrait__link__url: content.field_link.0['#url_title'],
content_spotlight_portrait__link_two__content: content.field_link_two.0['#title'],
content_spotlight_portrait__link_two__url: content.field_link_two.0['#url_title'],
content_spotlight_portrait__style: content.field_style_variation.0['#markup'],
content_spotlight_portrait__position: content.field_style_position.0['#markup'],
content_spotlight_portrait__theme: content.field_style_color.0['#markup'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@

{% embed "@molecules/text-with-image/yds-text-with-image.twig" with {
text_with_image__heading: content.field_heading.0,
text_with_image__heading_level: content.field_heading_level.0['#markup'],
text_with_image__subheading: content.field_subheading.0,
text_with_image__text: content.field_text,
text_with_image__link__content: content.field_link.0['#title'],
text_with_image__link__url: content.field_link.0['#url_title'],
text_with_image__link_two__content: content.field_link_two.0['#title'],
text_with_image__link_two__url: content.field_link_two.0['#url_title'],
text_with_image__focus: content.field_style_variation.0['#markup'],
text_with_image__position: content.field_style_position.0['#markup'],
text_with_image__width: content.field_style_width.0['#markup'],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends "@atomic/block/layout-builder/_layout-builder-block-template.twig" %}

{% set image_banner__video = paragraph.field_media.entity.field_media_video_file.entity.uri.value is not empty %}

{% block content %}
{% embed "@molecules/banner/image/yds-image-banner.twig" with {
image_banner__video: image_banner__video,
image_banner__content_background: image_banner__content_background
} %}
{% block image_banner__video %}
{% if image_banner__video %}
{% set image_banner__video = true %}
{{ content.field_media }}
{% endif %}
{% endblock %}

{% block image_banner__image %}
{% if not image_banner__video %}
{{ content.field_media }}
{% endif %}
{% endblock %}
{% endembed %}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "@atomic/block/layout-builder/_layout-builder-block-template.twig" %}

{% set video__width = "site" %}
{% set video__alignment = content.field_style_alignment.0['#markup']|default('left') %}

{% block content %}

{% if parentNode == 'post' or parentNode == 'event' %}
{% set video__width = "content" %}
{% set video__alignment = "center" %}
{% else %}
{% set video__width = "site" %}
{% set video__alignment = "left" %}
{% endif %}

{% embed "@molecules/video/yds-video.twig" with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,18 @@
class: bem(view__base_class, view__modifiers),
} %}
{% endif %}

<div {{ add_attributes(view__attibutes) }}>
{% embed "@organisms/component-wrapper/yds-component-wrapper.twig" with {
component_wrapper__width: component_wrapper__width|default('site'),
component_wrapper__label: content.field_heading.0 ? content.field_heading : '',
}%}
{% block component_wrapper_inner %}
{% if content.field_heading_links.0 %}
<div class="cta-group">
{{ content.field_heading_links|children }}
</div>
{% endif %}
{% if content.field_view_params %}
{{ content.field_view_params }}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "@atomic/field/field--node--field-category--list-item.html.twig" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "@atomic/field/field--node--field-category--list-item.html.twig" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "@atomic/field/field--node--field-category--list-item.html.twig" %}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "@atoms/lists/taxonomy/yds-categories-list.twig" %}
1 change: 1 addition & 0 deletions templates/field/field--node--field-tags--card.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "@atomic/field/field--node--field-tags--list-item.html.twig" %}
3 changes: 3 additions & 0 deletions templates/field/field--node--field-tags--list-item.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% include "@atoms/lists/taxonomy/yds-tags-list.twig" with {
url: url('entity.node.canonical', {'node': element['#object'].id}),
}%}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "@atomic/form/form--views--views-basic-scaffold.html.twig" %}
25 changes: 25 additions & 0 deletions templates/form/form--views--views-basic-scaffold.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{#
/**
* @file
* Theme override for a 'form' element.
*
* Available variables
* - attributes: A list of HTML attributes for the wrapper element.
* - children: The child elements of the form.
*
* @see template_preprocess_form()
*/
#}

{{ attach_library('atomic/chosen-select') }}

{%
set classes = [
'ys-filter-form',
'ys-filter-form--scaffold',
]
%}

<form{{ attributes.addClass(classes) }}>
{{ children }}
</form>
28 changes: 26 additions & 2 deletions templates/form/ys-search-form.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
<form action="/search" method="get" class="search-form--page form--inline" id="page-search-form" accept-charset="UTF-8">
<div class="form-item form-item-keywords">
<input placeholder="Start new search" type="text" id="edit-keywords--page-search-form" name="keywords" value="" size="30" maxlength="128" class="form-text form-item__textfield">
<div class="form-item form-item--search form-item-keywords">
<label for="edit-keywords--page-search-form" class="form-item__label">
<span>{{ 'Search:'|t }}</span>
{% include "@atoms/images/icons/_yds-icon.twig" with {
icon__name: 'magnifying-glass',
icon__blockname: 'form-item',
icon__modifiers: ['search'],
icon__decorative: true,
} %}
</label>
<input placeholder="Start new search" type="text" id="edit-keywords--page-search-form" name="keywords" value="{{ getQueryParam('keywords') }}"
size="30" maxlength="128" class="form-text form-item__textfield">
</div>
{% if show_content_type_filter %}
<div class="form-item">
<label for="edit-type--page-search-form" class="form-item__label">{{ 'Show:'|t }}</label>
<div class="form-item__dropdown">
<select data-drupal-selector="edit-type" id="edit-type--page-search-form" name="type"
class="form-select form-item__select">
<option value="all" selected="selected">{{'- All -'|t}}</option>
{% for key, value in content_type_list %}
<option value="{{ key }}" {% if key == getQueryParam('type') %}selected{% endif %}>{{ value|capitalize }}</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
<div class="form-actions form-wrapper" id="edit-actions--page-search-form">
{% include '@atoms/controls/cta/yds-cta.twig' with {
control__element: 'input',
Expand Down
12 changes: 12 additions & 0 deletions templates/node/node--event--card.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@
reference_card__cta_secondary__content: 'Add to Calendar',
reference_card__cta_secondary__href: ics_url,
reference_card__image_aria: heading[0]['#context'].value,
show_categories: node.show_categories,
show_tags: node.show_tags,
show_thumbnail: node.show_thumbnail,
} %}

{% block reference_card__tags %}
{{ content.field_tags }}
{% endblock %}

{% block reference_card__categories %}
{{ content.field_category }}
{% endblock %}

{% block reference_card__image %}
{% if localist_image_url %}
{% include "@atoms/images/image/_responsive-image.twig" with {
Expand Down
12 changes: 12 additions & 0 deletions templates/node/node--event--list-item.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@
reference_card__cta_secondary__content: 'Add to Calendar',
reference_card__cta_secondary__href: ics_url,
reference_card__image_aria: heading[0]['#context'].value,
show_categories: node.show_categories,
show_tags: node.show_tags,
show_thumbnail: node.show_thumbnail,
} %}

{% block reference_card__tags %}
{{ content.field_tags }}
{% endblock %}

{% block reference_card__categories %}
{{ content.field_category }}
{% endblock %}

{% block reference_card__image %}
{% if localist_image_url %}
{% include "@atoms/images/image/_responsive-image.twig" with {
Expand Down
12 changes: 12 additions & 0 deletions templates/node/node--page--card.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@
reference_card__snippet: content.field_teaser_text,
reference_card__image: 'true',
reference_card__image_aria: heading[0]['#context'].value,
show_categories: node.show_categories,
show_tags: node.show_tags,
show_thumbnail: node.show_thumbnail,
} %}

{% block reference_card__tags %}
{{ content.field_tags }}
{% endblock %}

{% block reference_card__categories %}
{{ content.field_category }}
{% endblock %}

{% block reference_card__image %}

{% if content.field_teaser_media[0] %}
Expand Down
12 changes: 12 additions & 0 deletions templates/node/node--page--list-item.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image_aria: heading[0]['#context'].value,
show_categories: node.show_categories,
show_tags: node.show_tags,
show_thumbnail: node.show_thumbnail,
} %}

{% block reference_card__tags %}
{{ content.field_tags }}
{% endblock %}

{% block reference_card__categories %}
{{ content.field_category }}
{% endblock %}

{% block reference_card__image %}

{% if content.field_teaser_media[0] %}
Expand Down
Loading

0 comments on commit 532459d

Please sign in to comment.