Skip to content

Commit

Permalink
UHF-7269: Merge branch 'main' into UHF-7269_JS_fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
xkhaven committed Oct 19, 2023
2 parents 908b0b2 + 9adca24 commit 819a36b
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 40 deletions.
4 changes: 4 additions & 0 deletions 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
2 changes: 0 additions & 2 deletions templates/paragraphs/paragraph--hearings.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
url: 'https://kerrokantasi.hel.fi/hearings/list?lang=' ~ current_langcode,
class: 'hearings__link',
is_external: true,
open_in_a_new_window: true,
} %}
{% else %}
<section class="hearings__results">
Expand All @@ -39,7 +38,6 @@
url: 'https://kerrokantasi.hel.fi/hearings/list?lang=' ~ current_langcode,
class: 'hearings__link',
is_external: true,
open_in_a_new_window: true,
} %}
{% endif %}
{% endblock component_content %}
Expand Down
12 changes: 12 additions & 0 deletions translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,18 @@ 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"

msgctxt "Table of contents, no javascript"
msgid "Table of contents requires JavaScript. Your browser doesn't support JavaScript or it is disabled. Please check your browser settings and try again."
msgstr "Sisällysluettelo käyttää JavaScriptiä. Selaimesi ei tue JavaScriptiä tai se on pois käytöstä. Tarkista selaimesi asetukset ja yritä uudelleen."
12 changes: 12 additions & 0 deletions translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,18 @@ 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"

msgctxt "Table of contents, no javascript"
msgid "Table of contents requires JavaScript. Your browser doesn't support JavaScript or it is disabled. Please check your browser settings and try again."
msgstr "Innehållsförteckning använder JavaScript. Din webbläsare stöder inte JavaScript eller det är inaktiverad. Kontrollera webbläsarens inställningar och försök igen."

0 comments on commit 819a36b

Please sign in to comment.