Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-9032: TPR Unit additional info in accordions #797

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/css/styles.min.css

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/scss/06_components/paragraphs/_accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@
> *:first-child {
margin-top: 0;
}

// Removes the gap between accordion heading and accordion content caused by p (or other) tag.
> .component--paragraph-text .component__content div:first-child > *:first-child {
margin-top: 0;
}
}

.component--accordion .component--image .component__content {
Expand Down
109 changes: 71 additions & 38 deletions templates/module/helfi_tpr/tpr-unit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* @see hdbt_admin_tools_preprocess_tpr_unit()
*/
#}
{% set has_prices = content.price_info|render ? true : false %}
{% set has_contacts = content.contacts|render ? true : false %}
{% set has_other_info = content.highlights|render or content.topical|render or content.other_info|render or content.links|render ?: false %}

{% set supports_swedish %}
{% if 'sv' in provided_languages %}
Expand Down Expand Up @@ -83,46 +86,76 @@

{{ content.field_content }}

{% if content.price_info|render %}
{% embed "@hdbt/misc/component.twig" with {
component_classes: [ 'component--paragraph-text' ],
component_title: content.price_info['#title'],
}%}
{% block component_content %}
{{ content.price_info }}
{% endblock component_content %}
{% endembed %}
{% endif %}

{% if content.contacts|render %}
{% embed "@hdbt/misc/component.twig" with {
component_classes: [ 'component--paragraph-text' ],
component_title: content.contacts['#title'],
}%}
{% block component_content %}
{{ content.contacts }}
{% endblock component_content %}
{% endembed %}
{% endif %}
{% if has_prices or has_contacts or has_other_info %}
{% embed "@hdbt/misc/component.twig" with
{
component_classes: [
'component--accordion',
'component--accordion-bg-grey',
'component--hardcoded'
],
component_content_class: 'accordion',
}
%}
{% block component_content %}

{% if content.links|render %}
{% embed "@hdbt/misc/component.twig" with {
component_classes: [ 'component--paragraph-text' ],
component_title: content.links['#title'],
}%}
{% block component_content %}
{{ content.links }}
{% endblock component_content %}
{% endembed %}
{% endif %}
{% if has_prices %}
{% set accordion_content %}

{% embed "@hdbt/misc/component.twig" with { component_classes: [ 'component--paragraph-text' ] } %}
{% block component_content %}
{{ content.price_info }}
{% endblock component_content %}
{% endembed %}

{% endset %}

{% include '@hdbt/component/accordion.twig' ignore missing with {
heading_level: 'h2',
heading: 'Charges'|t({}, {'context': 'TPR Unit tpr data accordion heading'}),
content: accordion_content,
} %}
{% endif %}

{% if has_contacts %}
{% set contacts_accordion_content %}

{% embed "@hdbt/misc/component.twig" with { component_classes: [ 'component--paragraph-text' ] } %}
{% block component_content %}
{{ content.contacts }}
{% endblock component_content %}
{% endembed %}

{% endset %}

{% include '@hdbt/component/accordion.twig' ignore missing with {
heading_level: 'h2',
heading: 'Other contact information'|t({}, {'context': 'TPR Unit tpr data accordion heading'}) ,
content: contacts_accordion_content,
} %}
{% endif %}

{% if has_other_info %}
{% set other_info_accordion_content %}

{% embed "@hdbt/misc/component.twig" with { component_classes: [ 'component--paragraph-text' ] } %}
{% block component_content %}
{{ content.highlights }}
{{ content.topical }}
{{ content.other_info }}
{{ content.links }}
{% endblock component_content %}
{% endembed %}

{% endset %}
{% endif %}

{% include '@hdbt/component/accordion.twig' ignore missing with {
heading_level: 'h2',
heading: 'Further information'|t({}, {'context': 'TPR Unit tpr data accordion heading'}),
content: other_info_accordion_content,
} %}

{% if content.other_info|render %}
{% embed "@hdbt/misc/component.twig" with {
component_classes: [ 'component--paragraph-text' ],
component_title: content.other_info['#title'],
}%}
{% block component_content %}
{{ content.other_info }}
{% endblock component_content %}
{% endembed %}
{% endif %}
Expand Down
12 changes: 12 additions & 0 deletions translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -718,3 +718,15 @@ msgstr "Palvelukieli"
msgctxt "TPR unit contact information HSL Journey Planner link"
msgid "Show the route in the HSL Journey Planner"
msgstr "Näytä reitti HSL-reittioppaassa"

msgctxt "TPR Unit tpr data accordion heading"
msgid "Charges"
msgstr "Hinnat"

msgctxt "TPR Unit tpr data accordion heading"
msgid "Other contact information"
msgstr "Muut yhteystiedot"

msgctxt "TPR Unit tpr data accordion heading"
msgid "Further information"
msgstr "Lisätiedot"
12 changes: 12 additions & 0 deletions translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -711,3 +711,15 @@ msgstr "Servicespråk"
msgctxt "TPR unit contact information HSL Journey Planner link"
msgid "Show the route in the HSL Journey Planner"
msgstr "Visa rutten i HRT:s reseplaneraren"

msgctxt "TPR Unit tpr data accordion heading"
msgid "Charges"
msgstr "Priser"

msgctxt "TPR Unit tpr data accordion heading"
msgid "Other contact information"
msgstr "Andra kontaktuppgifter"

msgctxt "TPR Unit tpr data accordion heading"
msgid "Further information"
msgstr "Ytterligare uppgifter"