From d76c954a495eb4cac7857cc622efd15f29ad39fe Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Fri, 26 Jul 2024 16:57:21 +0300 Subject: [PATCH 1/2] UHF-10191: Change district and project content type images to use new responsive image styles --- ...re.entity_view_display.node.district.teaser.yml | 10 +++------- ...re.entity_view_display.node.project.default.yml | 6 +++--- ...ore.entity_view_display.node.project.teaser.yml | 14 +++++--------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/conf/cmi/core.entity_view_display.node.district.teaser.yml b/conf/cmi/core.entity_view_display.node.district.teaser.yml index 41feab674..ea30981f1 100644 --- a/conf/cmi/core.entity_view_display.node.district.teaser.yml +++ b/conf/cmi/core.entity_view_display.node.district.teaser.yml @@ -14,10 +14,8 @@ dependencies: - field.field.node.district.field_metatags - field.field.node.district.field_sidebar_content - field.field.node.district.field_subdistricts - - image.style.3_2_s - node.type.district module: - - media - user id: node.district.teaser targetEntityType: node @@ -25,13 +23,11 @@ bundle: district mode: teaser content: field_district_image: - type: media_thumbnail + type: entity_reference_entity_view label: hidden settings: - image_link: '' - image_style: 3_2_s - image_loading: - attribute: lazy + view_mode: card + link: false third_party_settings: { } weight: 1 region: content diff --git a/conf/cmi/core.entity_view_display.node.project.default.yml b/conf/cmi/core.entity_view_display.node.project.default.yml index 73e22db0b..600682199 100644 --- a/conf/cmi/core.entity_view_display.node.project.default.yml +++ b/conf/cmi/core.entity_view_display.node.project.default.yml @@ -74,8 +74,8 @@ content: settings: timezone_override: '' format_type: project_schedule - separator: '-' from_to: both + separator: '-' third_party_settings: { } weight: 11 region: content @@ -83,7 +83,7 @@ content: type: entity_reference_entity_view label: hidden settings: - view_mode: image + view_mode: main_image link: false third_party_settings: { } weight: 2 @@ -102,8 +102,8 @@ content: settings: timezone_override: '' format_type: project_schedule - separator: '-' from_to: both + separator: '-' third_party_settings: { } weight: 12 region: content diff --git a/conf/cmi/core.entity_view_display.node.project.teaser.yml b/conf/cmi/core.entity_view_display.node.project.teaser.yml index ddfd5a89e..edd459e28 100644 --- a/conf/cmi/core.entity_view_display.node.project.teaser.yml +++ b/conf/cmi/core.entity_view_display.node.project.teaser.yml @@ -18,12 +18,10 @@ dependencies: - field.field.node.project.field_project_theme - field.field.node.project.field_project_type - field.field.node.project.field_sidebar_content - - image.style.3_2_s - node.type.project module: - datetime_range - link - - media - user id: node.project.teaser targetEntityType: node @@ -44,8 +42,8 @@ content: settings: timezone_override: '' format_type: project_schedule - separator: '-' from_to: both + separator: '-' third_party_settings: { } weight: 3 region: content @@ -62,13 +60,11 @@ content: weight: 6 region: content field_project_image: - type: media_thumbnail + type: entity_reference_entity_view label: hidden settings: - image_link: '' - image_style: 3_2_s - image_loading: - attribute: lazy + view_mode: card + link: false third_party_settings: { } weight: 1 region: content @@ -78,8 +74,8 @@ content: settings: timezone_override: '' format_type: project_schedule - separator: '-' from_to: both + separator: '-' third_party_settings: { } weight: 2 region: content From a74015a1366f56bb72e9a0341c8ffabbe90c802f Mon Sep 17 00:00:00 2001 From: Tero Elonen Date: Tue, 27 Aug 2024 15:35:49 +0300 Subject: [PATCH 2/2] UHF-10191: Fix broken layout on fallback view from district and project search, fix translations to apply on District word --- .../content/node--district--teaser.html.twig | 84 ++++++++----------- .../custom/hdbt_subtheme/translations/fi.po | 4 +- .../custom/hdbt_subtheme/translations/sv.po | 4 +- 3 files changed, 43 insertions(+), 49 deletions(-) diff --git a/public/themes/custom/hdbt_subtheme/templates/content/node--district--teaser.html.twig b/public/themes/custom/hdbt_subtheme/templates/content/node--district--teaser.html.twig index 4dce93b5f..aa68b6a9d 100644 --- a/public/themes/custom/hdbt_subtheme/templates/content/node--district--teaser.html.twig +++ b/public/themes/custom/hdbt_subtheme/templates/content/node--district--teaser.html.twig @@ -5,50 +5,40 @@ ] %} -{% set link_title %} - {{ title_prefix }} -

- {{ label }} -

- {{ title_suffix }} -{% endset %} - -{% set link_attributes = { - 'class': [ - 'district-teaser__link', - ], - 'rel': 'bookmark', -} %} - - -
- {% if content.field_district_image.0 %} - {{ content.field_district_image }} - {% else %} - {% include '@hdbt/media/image--card.html.twig' with {content: '' } %} - {% endif %} -
-
- {% set tag_content %} - {{ 'District'|t }} - {% endset %} - {% embed '@hdbt/misc/tag-list.twig' with { tag_container_class: ' content-tags--card' } %} - {% block content %} - {% include '@hdbt/misc/tag.twig' with { - color: 'coat-of-arms', - tag: tag_content - }%} - {% endblock content %} - {% endembed %} - {{ link(link_title, node_url, link_attributes) }} - {% if content.field_subdistricts.0 %} - {% include '@hdbt/misc/metadata-item.twig' with { - item_icon: 'location', - item_label: 'Districts'|t, - item_content: content.field_subdistricts, - }%} - {% endif %} - - {% include "@hdbt/misc/icon.twig" with {icon: 'arrow-right' } only %} -
- +{% if content.field_subdistricts.0 %} + {% set subdistricts = content.field_subdistricts %} + {% embed '@hdbt/component/card.twig' with { + card_modifier_class: classes|join(' '), + card_image: content.field_district_image, + card_title: label, + card_url: node_url, + card_metas: [ + { + icon: 'location', + label: 'Districts'|t, + content: subdistricts + }, + ], + card_tags: [ + { + tag: 'District'|t, + color: 'coat-of-arms', + }, + ], + } %} + {% endembed %} +{% else %} + {% embed '@hdbt/component/card.twig' with { + card_modifier_class: classes|join(' '), + card_image: content.field_district_image, + card_title: label, + card_url: node_url, + card_tags: [ + { + tag: 'District'|t, + color: 'coat-of-arms', + }, + ], + } %} + {% endembed %} +{% endif %} diff --git a/public/themes/custom/hdbt_subtheme/translations/fi.po b/public/themes/custom/hdbt_subtheme/translations/fi.po index db1eab2e3..92632dcec 100644 --- a/public/themes/custom/hdbt_subtheme/translations/fi.po +++ b/public/themes/custom/hdbt_subtheme/translations/fi.po @@ -1,4 +1,6 @@ -# Finnish translations +msgid "" +msgstr "" + msgid "District" msgstr "Alue" diff --git a/public/themes/custom/hdbt_subtheme/translations/sv.po b/public/themes/custom/hdbt_subtheme/translations/sv.po index 2a5631218..e79f0dd8b 100644 --- a/public/themes/custom/hdbt_subtheme/translations/sv.po +++ b/public/themes/custom/hdbt_subtheme/translations/sv.po @@ -1,4 +1,6 @@ -# Swedish translations +msgid "" +msgstr "" + msgid "District" msgstr "Område"