Skip to content

Commit

Permalink
UHF-9132: Merge branch 'main' of https://github.com/City-of-Helsinki/…
Browse files Browse the repository at this point in the history
…drupal-hdbt into UHF-9132
  • Loading branch information
teroelonen committed Nov 21, 2023
2 parents 2d33479 + f401aa0 commit 285a225
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/css/styles.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/embedded-content-cookie-compliance.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 21 additions & 11 deletions hdbt.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ hdbt-icons:
dist/css/hdbt-icons.css: {}

embedded-content-cookie-compliance:
version: 1.x
version: 1.0
js:
dist/js/embedded-content-cookie-compliance.min.js: {}
dependencies:
Expand Down Expand Up @@ -141,18 +141,22 @@ nav-global:
- hdbt/nav-toggle

event-list:
version: 1.x
version: 1.0
js:
dist/js/linkedevents.min.js: {}
dist/js/linkedevents.min.js: {
preprocess: false
}
dependencies:
- core/drupalSettings
- core/jquery
- core/drupal

school-search:
version: 1.x
version: 1.0
js:
dist/js/school-search.min.js: {}
dist/js/school-search.min.js: {
preprocess: false
}
dependencies:
- core/drupalSettings
- core/drupal
Expand All @@ -169,25 +173,31 @@ hyphenopoly:
}

job-search:
version: 1.x
version: 1.0
js:
dist/js/job-search.min.js: {}
dist/js/job-search.min.js: {
preprocess: false
}
dependencies:
- core/drupalSettings
- core/drupal

district-and-project-search:
version: 1.x
version: 1.0
js:
dist/js/district-and-project-search.min.js: {}
dist/js/district-and-project-search.min.js: {
preprocess: false
}
dependencies:
- core/drupalSettings
- core/drupal

news-archive:
version: 1.x
version: 1.0
js:
dist/js/news-archive.min.js: {}
dist/js/news-archive.min.js: {
preprocess: false
}
dependencies:
- core/drupalSettings
- core/drupal
Expand Down
11 changes: 11 additions & 0 deletions hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,17 @@ function hdbt_preprocess_tpr_unit(&$variables): void {
'unit_picture_caption'
);
}

// Check if the unit is a daycare unit.
$variables['is_daycare_unit'] = FALSE;
if ($entity->hasField('field_unit_type')) {
$types = $entity->get('field_unit_type')->referencedEntities();
foreach ($types as $type) {
if ($type->id() == 1) {
$variables['is_daycare_unit'] = TRUE;
}
}
}
}

/**
Expand Down
12 changes: 9 additions & 3 deletions src/js/embedded-content-cookie-compliance.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
// eslint-disable-next-line func-names
(function ($, Drupal, drupalSettings) {
function loadEmbeddedContent() {
if (typeof Drupal.eu_cookie_compliance === 'undefined') {
if (
typeof Drupal.eu_cookie_compliance === 'undefined' ||
!drupalSettings.embedded_media_attributes
) {
return;
}

if (Drupal.eu_cookie_compliance.hasAgreed('preference') && Drupal.eu_cookie_compliance.hasAgreed('statistics')) {
if (
Drupal.eu_cookie_compliance.hasAgreed('preference') &&
Drupal.eu_cookie_compliance.hasAgreed('statistics')
) {
// eslint-disable-next-line no-restricted-syntax
for (const [id, attributes] of Object.entries(drupalSettings.embedded_media_attributes)) {
const iframeElement = document.createElement('iframe');
Expand Down Expand Up @@ -59,7 +65,7 @@
skipLinkAfter.text = Drupal.t('Continue above the journey planner', {}, { context: 'Skip link after the journey planner for the journey planner paragraph' });
skipLinkBefore.text = Drupal.t('Continue below the journey planner', {}, { context: 'Skip link before the journey planner for the journey planner paragraph' });
$(`.embedded-content-cookie-compliance.media-${id}`)
.replaceWith(skipLinkBefore, containerElement, skipLinkAfter);
.replaceWith(skipLinkBefore, containerElement, skipLinkAfter);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/scss/06_components/pages/_cookie-compliance.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
}

.cookie-compliance-block {
@include components-container-max-width;
@include component-side-padding;

.cookie-selection-instruction {
@include font('body');
border-bottom: 1px solid $color-black-20;
Expand Down
2 changes: 1 addition & 1 deletion templates/layout/region--tools.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @see template_preprocess_region()
*/
#}
{% if content %}
{% if content|render %}
<div{{ attributes.addClass('tools__container') }}>
{{ content }}
</div>
Expand Down
22 changes: 19 additions & 3 deletions templates/module/helfi_tpr/tpr-unit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
{% set has_prices = content.price_info|render ? true : false %}
{% set has_contacts = content.contacts|render ? true : false %}
{% set has_ontologyword_details = content.field_ontologyword_details|render ? true : false %}
{% set has_subgroup = content.subgroup|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 %}
Expand Down Expand Up @@ -86,7 +87,7 @@

{{ content.field_content }}

{% if has_prices or has_contacts or has_other_info %}
{% if has_prices or has_contacts or has_other_info or has_subgroup or has_ontologyword_details %}
{% embed "@hdbt/misc/component.twig" with
{
component_classes: [
Expand Down Expand Up @@ -134,6 +135,23 @@
} %}
{% endif %}

{% if is_daycare_unit and has_subgroup %}
{% set subgroup_accordion_content %}

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

{% endset %}
{% include '@hdbt/component/accordion.twig' ignore missing with {
heading_level: 'h2',
heading: 'Contact details of daycare centre groups'|t({}, {'context': 'TPR Unit tpr data accordion heading'}) ,
content: subgroup_accordion_content,
} %}
{% endif %}

{% if has_ontologyword_details %}
{% set ontologyword_details_accordion_content %}

Expand All @@ -142,15 +160,13 @@
{{ content.field_ontologyword_details }}
{% endblock component_content %}
{% endembed %}

{% endset %}

{% include '@hdbt/component/accordion.twig' ignore missing with {
heading_level: 'h2',
heading: 'Language program and weighted curriculum education'|t({}, {'context': 'TPR Ontologyword details schools'}),
content: ontologyword_details_accordion_content,
} %}

{% endif %}

{% if has_other_info %}
Expand Down
4 changes: 4 additions & 0 deletions translations/fi.po
Original file line number Diff line number Diff line change
Expand Up @@ -834,3 +834,7 @@ msgstr "Tyhjennä valinnat"
msgctxt "Job search no results message"
msgid "Jobs meeting search criteria was not found. Try different search criteria."
msgstr "Hakuehtoja vastaavia työpaikkoja ei löytynyt. Kokeile muita hakuehtoja."

msgctxt "TPR Unit tpr data accordion heading"
msgid "Contact details of daycare centre groups"
msgstr "Päiväkotiryhmien yhteystiedot"
4 changes: 4 additions & 0 deletions translations/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -827,3 +827,7 @@ msgstr "Töm urvalet"
msgctxt "Job search no results message"
msgid "Jobs meeting search criteria was not found. Try different search criteria."
msgstr "Lediga jobb som uppfyller kriterierna finns inte. Prova andra kriterierna för sök."

msgctxt "TPR Unit tpr data accordion heading"
msgid "Contact details of daycare centre groups"
msgstr "Barngruppernas kontaktuppgifter"

0 comments on commit 285a225

Please sign in to comment.