Add a restart button to the survey draft view
Pretesters had no way to leave or restart the draft view other than clicking through every remaining question (customer pretest finding no. 2). The preview keeps its state exclusively in hidden POST fields, so a plain GET on the preview URL starts over at question 1 - the new 'Umfragenentwurf von vorn beginnen' button in the preview notice bar links exactly there and is visible on every draft page including the completion page. Jump marks remain deliberately unsupported so the draft view keeps mirroring the real participation flow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c885d2e4c4
commit
ab2dbfbc45
5 files changed
+24
-1
No files matched your search
@@ -30,7 +30,10 @@
|
||||
{% endif %}
|
||||
|
||||
{% if isPreview %}
|
||||
<div class="survey-alert warning">{{ 'survey.survey.preview_notice'|trans }}</div>
|
||||
<div class="survey-alert warning survey-preview-bar">
|
||||
<span>{{ 'survey.survey.preview_notice'|trans }}</span>
|
||||
<a class="survey-button secondary survey-preview-restart" href="{{ previewRestartUrl }}">{{ 'survey.survey.preview_restart'|trans }}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if progress.total > 0 %}
|
||||
|
||||
@@ -727,6 +727,20 @@
|
||||
.survey-alert.error { border-color: rgba(157, 82, 118, 0.28); color: var(--survey-purple); }
|
||||
.survey-alert.warning { border-color: rgba(236, 124, 50, 0.28); color: var(--survey-orange); }
|
||||
|
||||
.survey-preview-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.8rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.survey-preview-bar .survey-preview-restart {
|
||||
flex-shrink: 0;
|
||||
padding: 0.45rem 0.95rem;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.survey-kpis {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
|
||||
@@ -170,6 +170,10 @@ final class ShowSurveyController extends AbstractFrontendModuleController
|
||||
|
||||
private function buildPreviewResponse(FragmentTemplate $template, SurveyModel $survey, Request $request): Response
|
||||
{
|
||||
// Die Entwurfsansicht hält ihren Zustand nur in POST-Feldern – ein einfacher
|
||||
// GET auf dieselbe URL beginnt daher wieder bei Frage 1 ("von vorn beginnen").
|
||||
$template->set('previewRestartUrl', $request->getUri());
|
||||
|
||||
$history = $this->decodePreviewHistory((string) $request->request->get('preview_history', ''));
|
||||
$question = $this->resolvePreviewQuestion($survey, (int) $request->request->get('preview_question', 0));
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ survey:
|
||||
next: "Weiter"
|
||||
preview_badge: "Entwurf"
|
||||
preview_notice: "Dies ist eine Entwurfsansicht. Antworten können getestet werden, werden aber nicht gespeichert."
|
||||
preview_restart: "Umfragenentwurf von vorn beginnen"
|
||||
preview_thanks_text: "Der Testlauf ist abgeschlossen. Antworten wurden nicht gespeichert."
|
||||
results:
|
||||
section_kicker: "Themenbereich"
|
||||
|
||||
@@ -145,6 +145,7 @@ survey:
|
||||
next: "Next"
|
||||
preview_badge: "Draft"
|
||||
preview_notice: "This is a draft view. Answers can be tested, but they will not be stored."
|
||||
preview_restart: "Restart the survey draft"
|
||||
preview_thanks_text: "The test run is complete. Answers were not stored."
|
||||
results:
|
||||
section_kicker: "Topic section"
|
||||
|
||||
Reference in new issue
Block a user