Skip to content

Commit

Permalink
UHF-8689: Merge branch 'main' of github.com:City-of-Helsinki/drupal-h…
Browse files Browse the repository at this point in the history
…dbt into UHF-8689
  • Loading branch information
teroelonen committed Dec 16, 2024
2 parents ee652d9 + cd8b74a commit 13f242e
Show file tree
Hide file tree
Showing 50 changed files with 294 additions and 260 deletions.
2 changes: 1 addition & 1 deletion dist/css/styles.min.css

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/js/async/globalMenu.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/js/async/navToggleDropdown.chunk.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/js/async/toggleWidgets.chunk.js

This file was deleted.

2 changes: 1 addition & 1 deletion dist/js/district-and-project-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/health-station-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/helfi_calculator.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/home_care_client_fee.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/home_care_service_voucher.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/job-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/linkedevents.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/maternity-and-child-health-clinic-search.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/nav-toggle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/news-archive.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/ploughing-schedule.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/js/school-search.min.js

Large diffs are not rendered by default.

39 changes: 2 additions & 37 deletions hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use Drupal\menu_link_content\Plugin\Menu\MenuLinkContent;
use Drupal\node\Entity\Node;
use Drupal\responsive_image\Entity\ResponsiveImageStyle;
use Drupal\views\ViewExecutable;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

/**
* Retrieve possible theme color palette override.
Expand Down Expand Up @@ -72,9 +73,7 @@ function hdbt_preprocess_html(&$variables): void {
->getCurrentRequest()?->attributes->get('exception');

// Check if the page is error-page and add class error-page for the body.
if (
$page_status?->getStatusCode() > 400
) {
if ($page_status instanceof HttpExceptionInterface && $page_status->getStatusCode() > 400) {
$variables['attributes']['class'][] = 'error-page';
}

Expand Down Expand Up @@ -1841,40 +1840,6 @@ function hdbt_preprocess_paragraph__job_search(array &$variables) {
}
}

/**
* Implements hook_preprocess_HOOK().
*/
function hdbt_preprocess_external_entity__helfi_hearings(array &$variables) {
$language = \Drupal::languageManager()
->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)
->getId();
$entity = $variables['external_entity'];
$hearingLangcode = $entity->get('langcode')->value;
if ($hearingLangcode && $hearingLangcode == $language) {
return;
}
$existingLanguages = explode(',', $entity->get('existing_translations')->value);

if (in_array("fi", $existingLanguages) && in_array("en", $existingLanguages) && count($existingLanguages) === 2) {
$variables['available_in_languages'] = t('Hearing only available in Finnish and English', [], ['context' => 'Hearing available in languages']);
}
if (in_array("fi", $existingLanguages) && in_array("sv", $existingLanguages) && count($existingLanguages) === 2) {
$variables['available_in_languages'] = t('Hearing only available in Finnish and Swedish', [], ['context' => 'Hearing available in languages']);
}
if (in_array("en", $existingLanguages) && in_array("sv", $existingLanguages) && count($existingLanguages) === 2) {
$variables['available_in_languages'] = t('Hearing only available in English and Swedish', [], ['context' => 'Hearing available in languages']);
}
if (in_array("fi", $existingLanguages) && count($existingLanguages) === 1) {
$variables['available_in_languages'] = t('Hearing only available in Finnish', [], ['context' => 'Hearing available in languages']);
}
if (in_array("en", $existingLanguages) && count($existingLanguages) === 1) {
$variables['available_in_languages'] = t('Hearing only available in English', [], ['context' => 'Hearing available in languages']);
}
if (in_array("sv", $existingLanguages) && count($existingLanguages) === 1) {
$variables['available_in_languages'] = t('Hearing only available in Swedish', [], ['context' => 'Hearing available in languages']);
}
}

/**
* Implements hook_theme_suggestions_alter() for container.
*/
Expand Down
28 changes: 15 additions & 13 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions src/images/favicon/manifest.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"short_name": "hel.fi",
"name": "Helsingin kaupunki",
"icons": [
{ "src": "/favicon-192x192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "/favicon-512x512.png", "type": "image/png", "sizes": "512x512" }
{ "src": "https://www.hel.fi/etusivu-assets/themes/contrib/hdbt/src/images/favicon/favicon-192x192.png", "type": "image/png", "sizes": "192x192" },
{ "src": "https://www.hel.fi/etusivu-assets/themes/contrib/hdbt/src/images/favicon/favicon-512x512.png", "type": "image/png", "sizes": "512x512" }
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
Expand Down
2 changes: 1 addition & 1 deletion src/js/calculator/helfi_calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ class HelfiCalculator {
<legend class="helfi-calculator__legend helfi-calculator__legend--level_{{level}}{{^level}}2{{/level}}">{{text}}</legend>
`,
paragraph: `
<p>{{text}}</p>
<p{{#class}} class="{{class}}"{{/class}}>{{text}}</p>
`,
hr: `
<hr>
Expand Down
14 changes: 14 additions & 0 deletions src/js/calculator/home_care_client_fee/_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ function getFormData(id, t, { firstPerWeekPrice }) {
],
},
},
{
group: {
id: 'safetyphone_group',
hide_group: true,
items: [
{
paragraph: {
text: t('safetyphone_emergency_visit_explanation'),
class: 'hdbt-helper-text',
}
},
],
},
},
{
heading: {
text: t('shopping_service_heading'),
Expand Down
5 changes: 5 additions & 0 deletions src/js/calculator/home_care_client_fee/_translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ const translations = {
sv: 'Inkludera en trygghetstelefon och ett säkerhetsarmband i bedömningen',
en: 'Include the safety phone and safety bracelet in the estimate',
},
safetyphone_emergency_visit_explanation: {
fi: 'Huomiothan, että turvapalveluiden hälytyskäynti maksaa 23,25 € tai 46,50 € kerta tulorajoistasi riippuen. Kuukausittain laskutamme enintään 5 hälytyskäyntiä, eli tulorajoistasi riippuen enintään 116,25 € tai 232,50 € kuukaudessa.',
sv: 'Observera, att ett larmbesök från trygghetstjänsten kostar 23,25 € eller 46,50 € per gång, beroende på dina inkomstgränser. Vi fakturerar högst 5 larmbesök per månad. Det vill säga, beroende på dina inkomstgränser, max 116,25 € eller 232,50 € per månad.',
en: 'Please note that an emergency visit from the safety services costs EUR 23.25 or EUR 46.50 per visit, depending on your income limits. Each month, you will be billed for a maximum of five emergency visits, totalling no more than EUR 116.25 or EUR 232.50, depending on your income limits.',
},
yes_calculate: {
fi: 'Kyllä, laske arvioon.',
sv: 'Ja, inkludera i bedömningen.',
Expand Down
19 changes: 12 additions & 7 deletions src/js/calculator/home_care_client_fee/home_care_client_fee.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,18 @@ class HomeCareClientFee {
});

const update = () => {
const mealService = this.calculator.getFieldValue('meal_service');

if (mealService === '1') {
this.calculator.showGroup('meal_service_group');
} else {
this.calculator.hideGroup('meal_service_group');
}
const fields = [
{ field: 'safetyphone', group: 'safetyphone_group' },
{ field: 'meal_service', group: 'meal_service_group' },
];

fields.forEach(({ field, group }) => {
if (this.calculator.getFieldValue(field) === '1') {
this.calculator.showGroup(group);
} else {
this.calculator.hideGroup(group);
}
});
};

const validate = () => {
Expand Down
Loading

0 comments on commit 13f242e

Please sign in to comment.