Skip to content

Commit

Permalink
Merge pull request #905 from City-of-Helsinki/UHF-10191
Browse files Browse the repository at this point in the history
UHF-10191: Image style refactor
  • Loading branch information
khalima authored Sep 9, 2024
2 parents f4b567a + a74015a commit 14e063e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 64 deletions.
10 changes: 3 additions & 7 deletions conf/cmi/core.entity_view_display.node.district.teaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ 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
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
Expand Down
2 changes: 1 addition & 1 deletion conf/cmi/core.entity_view_display.node.project.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions conf/cmi/core.entity_view_display.node.project.teaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,40 @@
]
%}

{% set link_title %}
{{ title_prefix }}
<h3 class="content-card__title">
{{ label }}
</h3>
{{ title_suffix }}
{% endset %}

{% set link_attributes = {
'class': [
'district-teaser__link',
],
'rel': 'bookmark',
} %}

<article{{ attributes.addClass(classes) }}>
<div class="district-teaser__image">
{% if content.field_district_image.0 %}
{{ content.field_district_image }}
{% else %}
{% include '@hdbt/media/image--card.html.twig' with {content: '' } %}
{% endif %}
</div>
<div class="district-teaser__data">
{% set tag_content %}
<span>{{ 'District'|t }}</span>
{% 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 %}
</div>
</article>
{% 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 %}
4 changes: 3 additions & 1 deletion public/themes/custom/hdbt_subtheme/translations/fi.po
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Finnish translations
msgid ""
msgstr ""

msgid "District"
msgstr "Alue"

Expand Down
4 changes: 3 additions & 1 deletion public/themes/custom/hdbt_subtheme/translations/sv.po
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Swedish translations
msgid ""
msgstr ""

msgid "District"
msgstr "Område"

Expand Down

0 comments on commit 14e063e

Please sign in to comment.