From 4e10d07d2484e909e85bdd7260fb9051b53a8c12 Mon Sep 17 00:00:00 2001 From: Jan Slifka Date: Fri, 15 Dec 2023 17:28:13 +0100 Subject: [PATCH] [DSW-2146] Fix links to questions in questionnaires --- engine-wizard/elm/Wizard/Common/AppState.elm | 6 ++++++ .../elm/Wizard/Common/Components/Questionnaire.elm | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engine-wizard/elm/Wizard/Common/AppState.elm b/engine-wizard/elm/Wizard/Common/AppState.elm index a59cfaca6..7e490fa64 100644 --- a/engine-wizard/elm/Wizard/Common/AppState.elm +++ b/engine-wizard/elm/Wizard/Common/AppState.elm @@ -1,6 +1,7 @@ module Wizard.Common.AppState exposing ( AppState , acceptCookies + , getClientUrlRoot , getUserRole , init , isFullscreen @@ -128,6 +129,11 @@ getUserRole = Maybe.unwrap "" .role << .user << .config +getClientUrlRoot : AppState -> String +getClientUrlRoot appState = + String.replace "/wizard" "" appState.clientUrl + + setCurrentTime : AppState -> Time.Posix -> AppState setCurrentTime appState time = { appState | currentTime = time } diff --git a/engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm b/engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm index 469a5887f..26d56edbb 100644 --- a/engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm +++ b/engine-wizard/elm/Wizard/Common/Components/Questionnaire.elm @@ -965,7 +965,7 @@ update msg wrapMsg mbSetFullscreenMsg appState ctx model = Routing.toUrl appState <| Routes.projectsDetailQuestionnaire model.uuid (Just (String.join "." path)) in - ( appState.seed, { model | recentlyCopied = True }, Copy.copyToClipboard (appState.clientUrl ++ route) ) + ( appState.seed, { model | recentlyCopied = True }, Copy.copyToClipboard (AppState.getClientUrlRoot appState ++ route) ) ClearRecentlyCopied -> wrap { model | recentlyCopied = False }