Skip to content

Commit

Permalink
Merge pull request #1220 from openeuropa/EWPP-2861
Browse files Browse the repository at this point in the history
EWPP-2861: Add publication date field to file translation pattern.
  • Loading branch information
22Alexandra authored Dec 14, 2022
2 parents d3a1b45 + 29509c7 commit 011372b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions templates/content/media--document--default.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
'button_label': 'Download'|t,
'file': file,
'translations': translations|default([]),
'publication_date': publication_date,
}) }}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ file_translation:
label: "More information"
description: "Informative text about the available translations."
preview: "Looking for another language which is not on the list? Find out why."
publication_date:
type: "text"
label: "Publication date"
description: "Document publication date"
preview: "31 August 2020"
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
{% if file.size %}
{% set _meta = '(' ~ file.size|format_size ~ ' - ' ~ file.extension|upper ~ ')' %}
{% endif %}

{% set _detail_meta = [] %}
{% if publication_date is not empty %}
{% set _detail_meta = _detail_meta|merge([publication_date|upper]) %}
{% endif %}

{% include '@ecl-twig/file' with {
'title': file.title,
'language': file.language_code|to_language,
Expand Down Expand Up @@ -62,5 +68,6 @@
},
'description': more_info|default(''),
'items': _translations,
}
},
'detail_meta': _detail_meta
} only %}
4 changes: 4 additions & 0 deletions tests/src/Kernel/fixtures/rendering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@
language_code: "pt-pt"
translation_toggle_label: "Other translations"
more_info: "Custom information snippet."
publication_date: "31 August 2020"
assertions:
count:
'svg.ecl-file__icon': 1
Expand All @@ -514,6 +515,7 @@
'a.ecl-file__translation-download[hreflang="it"]': 1
'a.ecl-file__translation-download[hreflang="hu"]': 1
'a.ecl-file__translation-download[hreflang="pt"]': 1
'.ecl-file__info .ecl-file__detail-meta span.ecl-file__detail-meta-item': 1
equals:
'div.ecl-file__title': "File title example"
'div.ecl-file__language': "English"
Expand All @@ -529,6 +531,7 @@
'.ecl-file__translation-item:nth-child(4) div.ecl-file__translation-title': "português"
'.ecl-file__translation-item:nth-child(4) div.ecl-file__translation-meta': "(175.78 KB - DOC)"
'.ecl-file__translation-description': "Custom information snippet."
'.ecl-file__info .ecl-file__detail-meta span.ecl-file__detail-meta-item:nth-child(1)': '31 AUGUST 2020'
- array:
'#type': pattern
'#id': file_translation
Expand Down Expand Up @@ -556,6 +559,7 @@
'div.ecl-file__translation-container': 1
'li.ecl-file__translation-item a.ecl-file__translation-download': 1
'a.ecl-file__translation-download[href="http://example.com/document_fr.xls"]': 1
'.ecl-file__info .ecl-file__detail-meta span.ecl-file__detail-meta-item': 0
equals:
'div.ecl-file__title': "File title example"
'div.ecl-file__language': "English"
Expand Down

0 comments on commit 011372b

Please sign in to comment.