Skip to content

Commit

Permalink
YSP-281: Localist Project (#237)
Browse files Browse the repository at this point in the history
* feat(YSP-461): add new JS file/library for event-meta-localist

* feat(YSP-461): remove reference-card and custom-card JS libraries

* feat(YSP-461): add todo for multi-day event label

* feat(YSP-461): add multi_day_text

* fix(YSP-461): multi day event should not be passed to date function

* feat(YSP-461): add calculated ics_url and event_dates fields to view modes

* feat(YSP-461): add buttons

* feat(YSP-461): update wiring

* feat(YSP-461): fix multi-day event text appended to date

* feat(YSP-461): add localist_image_url to card template - wip

* feat(YSP-461): add localist_image_url to both card templates that need it

* feat(YSP-461): add localist_image_url to both card templates that need it - using image component include

* feat(YSP-461): wire reference_card__image_aria

* feat(YSP-276): Remove add to calendar links for past events

* feat(YSP-298): Adds multi-day event language to cards to match list and condensed

* feat(YSP-281): If cost, change from Register to Buy, also if Register is enabled, send to Localist Register instead of ticket CTA

* feat(YSP-281): Rework tickets to work with basic tickets or Localist Register tickets

* feat(YSP-560): Localist: Update Event lists + default image updates (#235)

* feat(YSP-560): wiring prefix variable for past event

* feat(YSP-560): make sure event_has_passed is set so we can display event_title_prefix for Past Event:

* feat(YSP-281): Template for taxonomy views

* refactor(YSP-281): Use best practices to include component library

---------

Co-authored-by: Marc Berger <[email protected]>
Co-authored-by: Joe Tower <[email protected]>
  • Loading branch information
3 people authored Jun 21, 2024
1 parent 486d303 commit e91bc77
Show file tree
Hide file tree
Showing 17 changed files with 140 additions and 47 deletions.
14 changes: 4 additions & 10 deletions atomic.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ primary-nav:
node_modules/@yalesites-org/component-library-twig/dist/js/03-organisms/menu/primary-nav/yds-primary-nav.js:
{}

reference-card:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/02-molecules/cards/reference-card/yds-reference-card.js:
{}

custom-card:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/02-molecules/cards/custom-card/yds-custom-card.js:
{}

breadcrumbs:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/03-organisms/menu/breadcrumbs/yds-breadcrumbs.js:
Expand Down Expand Up @@ -93,3 +83,7 @@ spotlights:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/02-molecules/content-spotlight-portrait/content-spotlights.js:
{}
event-localist:
js:
node_modules/@yalesites-org/component-library-twig/dist/js/02-molecules/meta/event-meta/event-meta-localist.js:
{}
3 changes: 3 additions & 0 deletions templates/field/field--node--title.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{% for item in items %}
{{ item.content }}
{% endfor %}
46 changes: 36 additions & 10 deletions templates/node/node--event--card.html.twig
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
{{ attach_library('atomic/reference-card') }}
{% set event_has_passed = event_dates is empty %}

{# Use event_dates array to print any event dates - look inside array for formatted options #}

{% if event_dates|length > 1 %}
{% set multi_day_text %}
{% include "@atoms/typography/text/yds-text.twig" with {
text__base_class: 'multi-day-event',
text__content: '(multi-day event)',
} %}
{% endset %}
{% endif %}

{% set date__formatted %}
{% include "@atoms/date-time/yds-date-time.twig" with {
date_time__start: content.field_event_date.0.start_time['#markup'],
} %}
} %} {{multi_day_text}}
{% endset %}

{% if content.field_event_type.0 %}
{% if content.field_localist_event_experience.0 %}
{% set reference_card__overline -%}
{% include "@molecules/cards/reference-card/event/_yds-event-format.twig" with {
format: content.field_event_type,
format: content.field_localist_event_experience,
} %}
{%- endset %}
{% endif %}
Expand All @@ -18,20 +29,35 @@

{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}

{# Set the event title prefix based on event status #}
{% set event_title__prefix = event_has_passed ? 'Past Event: ' : '' %}

{# field_ticket_registration_url #}
{# field_external_source #}
{% embed "@molecules/cards/reference-card/yds-reference-card.twig" with {
reference_card__prefix: event_title__prefix,
reference_card__heading: heading,
reference_card__subheading: date__formatted,
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image: 'true',
reference_card__cta_primary__href: ticket_url,
reference_card__cta_primary__content: cost_button_text,
reference_card__cta_secondary__content: 'Add to Calendar',
reference_card__cta_secondary__href: ics_url,
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}

{% if content.field_teaser_media[0] %}
{{ content.field_teaser_media }}
{% elseif getCoreSetting('image_fallback.teaser') %}
{{ drupal_entity('media', getCoreSetting('image_fallback.teaser'), 'card_secondary_3_2') }}
{% if localist_image_url %}
{% include "@atoms/images/image/_responsive-image.twig" with {
image__src: localist_image_url,
image__alt: localist_image_alt,
responsive_image__modifiers: ['localist-3-2'],
}%}
{% elseif content.field_teaser_media[0] %}
{{ content.field_teaser_media }}
{% elseif getCoreSetting('image_fallback.teaser') %}
{{ drupal_entity('media', getCoreSetting('image_fallback.teaser'), 'card_secondary_3_2') }}
{% endif %}

{% endblock %}
{% endembed %}
21 changes: 17 additions & 4 deletions templates/node/node--event--condensed.html.twig
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
{{ attach_library('atomic/reference-card') }}
{# Use event_dates array to print any event dates - look inside array for formatted options #}
{% if event_dates|length > 1 %}
{% set multi_day_text %}
{% include "@atoms/typography/text/yds-text.twig" with {
text__base_class: 'multi-day-event',
text__content: '(multi-day event)',
} %}
{% endset %}
{% endif %}

{% set event_has_passed = event_dates is empty %}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set reference_card__image = 'false' %}
{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}

{# Set the event title prefix based on event status #}
{% set event_title__prefix = event_has_passed ? 'Past Event: ' : '' %}

{% set date__formatted %}
{% include "@atoms/date-time/yds-date-time.twig" with {
date_time__start: content.field_event_date.0.start_time['#markup'],
} %}
} %} {{multi_day_text}}
{% endset %}

{% embed "@molecules/cards/reference-card/yds-reference-card.twig" with {
{% include "@molecules/cards/reference-card/yds-reference-card.twig" with {
reference_card__prefix: event_title__prefix,
reference_card__heading: heading,
reference_card__subheading: date__formatted,
reference_card__url: url,
} %}
{% endembed %}
44 changes: 33 additions & 11 deletions templates/node/node--event--list-item.html.twig
Original file line number Diff line number Diff line change
@@ -1,37 +1,59 @@
{{ attach_library('atomic/reference-card') }}
{% set event_has_passed = event_dates is empty %}

{# Use event_dates array to print any event dates - look inside array for formatted options #}
{% if event_dates|length > 1 %}
{% set multi_day_text %}
{% include "@atoms/typography/text/yds-text.twig" with {
text__base_class: 'multi-day-event',
text__content: '(multi-day event)',
} %}
{% endset %}
{% endif %}

{% set date__formatted %}
{% include "@atoms/date-time/yds-date-time.twig" with {
date_time__start: content.field_event_date.0.start_time['#markup'],
} %}
} %} {{ multi_day_text }}
{% endset %}

{% if content.field_event_type %}
{% if content.field_localist_event_experience.0 %}
{% set reference_card__overline -%}
{% include "@molecules/cards/reference-card/event/_yds-event-format.twig" with {
format: content.field_event_type,
format: content.field_localist_event_experience,
} %}
{%- endset %}
{% endif %}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}

{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}

{# Set the event title prefix based on event status #}
{% set event_title__prefix = event_has_passed ? 'Past Event: ' : '' %}

{% embed "@molecules/cards/reference-card/yds-reference-card.twig" with {
reference_card__prefix: event_title__prefix,
reference_card__heading: heading,
reference_card__subheading: date__formatted,
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image: 'true',
reference_card__cta_primary__href: ticket_url,
reference_card__cta_primary__content: cost_button_text,
reference_card__cta_secondary__content: 'Add to Calendar',
reference_card__cta_secondary__href: ics_url,
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}

{% if content.field_teaser_media[0] %}
{{ content.field_teaser_media }}
{% elseif getCoreSetting('image_fallback.teaser') %}
{{ drupal_entity('media', getCoreSetting('image_fallback.teaser'), 'card_list_3_2') }}
{% if localist_image_url %}
{% include "@atoms/images/image/_responsive-image.twig" with {
image__src: localist_image_url,
image__alt: localist_image_alt,
responsive_image__modifiers: ['localist-3-2'],
}%}
{% elseif content.field_teaser_media[0] %}
{{ content.field_teaser_media }}
{% elseif getCoreSetting('image_fallback.teaser') %}
{{ drupal_entity('media', getCoreSetting('image_fallback.teaser'), 'card_list_3_2') }}
{% endif %}

{% endblock %}
{% endembed %}
2 changes: 1 addition & 1 deletion templates/node/node--page--card.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}
Expand All @@ -9,6 +8,7 @@
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image: 'true',
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}

Expand Down
1 change: 0 additions & 1 deletion templates/node/node--page--condensed.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set reference_card__image = 'false' %}
Expand Down
2 changes: 1 addition & 1 deletion templates/node/node--page--list-item.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}
Expand All @@ -7,6 +6,7 @@
reference_card__heading: heading,
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}

Expand Down
2 changes: 1 addition & 1 deletion templates/node/node--post--card.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set date__formatted %}
{% include "@atoms/date-time/yds-date-time.twig" with {
Expand All @@ -15,6 +14,7 @@
reference_card__heading: heading,
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}

Expand Down
1 change: 0 additions & 1 deletion templates/node/node--post--condensed.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set reference_card__image = 'false' %}
Expand Down
2 changes: 1 addition & 1 deletion templates/node/node--post--list-item.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set date__formatted %}
{% include "@atoms/date-time/yds-date-time.twig" with {
Expand All @@ -15,6 +14,7 @@
reference_card__heading: heading,
reference_card__url: url,
reference_card__snippet: content.field_teaser_text,
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}

Expand Down
2 changes: 1 addition & 1 deletion templates/node/node--profile--card.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}
Expand All @@ -9,6 +8,7 @@
reference_card__url: url,
reference_card__snippet: content.field_subtitle,
reference_card__image: 'true',
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}
{% if content.field_teaser_media[0] %}
Expand Down
1 change: 0 additions & 1 deletion templates/node/node--profile--condensed.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set reference_card__image = 'false' %}
Expand Down
1 change: 0 additions & 1 deletion templates/node/node--profile--directory.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set reference_card__image = 'false' %}
Expand Down
2 changes: 1 addition & 1 deletion templates/node/node--profile--list-item.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{{ attach_library('atomic/reference-card') }}

{% set heading = content.field_teaser_title.0 ? content.field_teaser_title : label %}
{% set url = content.field_external_source[0]['#url']|render ? content.field_external_source[0]['#url']|render : url %}
Expand All @@ -8,6 +7,7 @@
reference_card__subheading: content.field_position,
reference_card__url: url,
reference_card__snippet: content.field_subtitle,
reference_card__image_aria: heading[0]['#context'].value,
} %}
{% block reference_card__image %}
{% if content.field_teaser_media[0] %}
Expand Down
2 changes: 0 additions & 2 deletions templates/paragraphs/paragraph--custom-card.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{{ attach_library('atomic/custom-card') }}

{% set custom_card__image = content.field_image.0 ? 'true' : 'false' %}

{% embed "@molecules/cards/custom-card/yds-custom-card.twig" with {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{% set dom_id_class = dom_id ? 'js-view-dom-id-' ~ dom_id %}

<div class={{ dom_id_class }}>

{% if header %}
<header>
{{ header }}
</header>
{% endif %}

{{ attachment_before }}

{% if rows -%}
{% embed "@organisms/card-collection/yds-card-collection.twig" with {
card_collection__heading: title,
card_collection__featured: 'true',
card_collection__type: 'list',
card_collection__width: 'site',
} %}
{% block card_collection__cards %}
{% for row in rows %}
{{- row.content -}}
{% endfor %}
{% endblock %}
{% endembed %}
{% elseif empty -%}
{{ empty }}
{% endif %}
{{ pager }}

{{ attachment_after }}
{{ more }}

{% if footer %}
<footer>
{{ footer }}
</footer>
{% endif %}

{{ feed_icons }}
</div>

0 comments on commit e91bc77

Please sign in to comment.