From 363f8d1608a023cdbf32fae943b74b84928a9dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tarmo=20Sundstr=C3=B6m?= Date: Thu, 13 Jun 2024 16:42:53 +0300 Subject: [PATCH 1/4] UHF-10101: Implement configurable TOS to hakuvahti --- hdbt.theme | 6 ++++++ .../job-search/containers/SearchMonitorContainer.tsx | 12 +++++++++++- src/js/types/drupalSettings.d.ts | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hdbt.theme b/hdbt.theme index e2d1e5db1..d826a5d29 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -78,6 +78,12 @@ function hdbt_preprocess(&$variables): void { $hakuvahtiUrl = getenv('HAKUVAHTI_URL'); $variables['#attached']['drupalSettings']['helfi_react_search']['hakuvahti_url_set'] = !empty($hakuvahtiUrl); + // Hakuvahti TOS settings. + $config = \Drupal::config('helfi_rekry_content.job_listings'); + $variables['#attached']['drupalSettings']['helfi_rekry_job_search']['hakuvahti_tos_checkbox_title'] = $config->get('hakuvahti_tos_checkbox_title') ?: 'undefined'; + $variables['#attached']['drupalSettings']['helfi_rekry_job_search']['hakuvahti_tos_title'] = $config->get('hakuvahti_tos_title') ?: 'undefined'; + $variables['#attached']['drupalSettings']['helfi_rekry_job_search']['hakuvahti_tos_url'] = $config->get('hakuvahti_tos_url') ?: 'undefined'; + // Required for allowing subtheming for HDBT theme. $variables['active_theme'] = $active_theme = \Drupal::theme()->getActiveTheme()->getName(); $variables['theme_prefix'] = $active_theme !== 'hdbt' ? $active_theme : ''; diff --git a/src/js/react/apps/job-search/containers/SearchMonitorContainer.tsx b/src/js/react/apps/job-search/containers/SearchMonitorContainer.tsx index 0c3d458b6..9dde51b74 100644 --- a/src/js/react/apps/job-search/containers/SearchMonitorContainer.tsx +++ b/src/js/react/apps/job-search/containers/SearchMonitorContainer.tsx @@ -135,6 +135,14 @@ const SearchMonitorContainer = () => { const thankYouHeader: string = Drupal.t('Your search has been saved', {}, { context: 'Search monitor thank you header' }); const thankYouMessage: string = Drupal.t('You will receive a confirmation link by email. You can activate the saved search via the link.', {}, { context: 'Search monitor thank you message' }); const errorLabel: string = Drupal.t('Please check these selections', {}, { context: 'Search monitor error label' }); + const tosCheckboxLabel: string = window.drupalSettings.helfi_rekry_job_search.hakuvahti_tos_checkbox_title; + const tosLinkLabel: string = window.drupalSettings.helfi_rekry_job_search.hakuvahti_tos_title; + const tosLinkUrl: string = window.drupalSettings.helfi_rekry_job_search.hakuvahti_tos_url; + + console.log('Extrabonanza'); + console.log(tosCheckboxLabel); + console.log(tosLinkLabel); + console.log(tosLinkUrl); const customCheckboxStyles = { '--background-unselected': 'var(--color-white)', @@ -196,7 +204,7 @@ const SearchMonitorContainer = () => { setTermsAgreed(event.target.checked)} checked={termsAgreed} @@ -205,6 +213,8 @@ const SearchMonitorContainer = () => { style={customCheckboxStyles} /> +

{tosLinkLabel}

+ -
+

{descriptionHeader}

{descriptionFirstPart}

{descriptionSecondPart}

@@ -202,6 +197,7 @@ const SearchMonitorContainer = () => { }} /> +

{tosLinkLabel}

{ style={customCheckboxStyles} /> -

{tosLinkLabel}

-