Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin' into fs-4573-stop-form-runner
Browse files Browse the repository at this point in the history
rebase
  • Loading branch information
Tiny49 committed Sep 16, 2024
2 parents 6d66a30 + fd9d771 commit 7b0b049
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions runner/src/server/plugins/engine/models/viewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class ViewModel {
saveAndContinueText: string;
confirmAndContinueText?: string;
isConfirmPageControllerRequest?: boolean;
isReadOnlySummary?: boolean;
continueText: string;
footer?: any;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,16 @@ export class SummaryPageController extends PageController {
);
viewModel.backLink = state.callback?.returnUrl;
}
if (state["metadata"] && state["metadata"]["is_read_only_summary"]) {
viewModel.isReadOnlySummary =
state["metadata"]["is_read_only_summary"];
viewModel.backLinkText = UtilHelper.getBackLinkText(
true,
this.model.def?.metadata?.isWelsh
);
viewModel.backLink = state.callback?.returnUrl;
}

return h.view("summary", viewModel);
};
}
Expand Down
6 changes: 3 additions & 3 deletions runner/src/server/views/partials/summary-detail.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% from "./summary-row.html" import summaryRow %}

{% macro summaryDetail(data) %}
{% macro summaryDetail(data, isReadOnlySummary=false) %}
{% set isRepeatableSection = (data.items[0] | isArray) %}
{% if not isRepeatableSection %}
{% if (not isRepeatableSection and not isReadOnlySummary) %}
<h2 class="govuk-heading-m">{{data.title}}</h2>
{% endif %}
<dl class="govuk-summary-list">
Expand All @@ -14,7 +14,7 @@ <h2 class="govuk-heading-m govuk-!-margin-top-4 govuk-!-margin-bottom-0">{{data.
{{ summaryRow(repeated) }}
{% endfor %}
{% else %}
{{ summaryRow(item, data.notSuppliedText, data.changeText) }}
{{ summaryRow(item, data.notSuppliedText, data.changeText, isReadOnlySummary) }}
{% endif %}
{% endif %}
{% endfor %}
Expand Down
4 changes: 3 additions & 1 deletion runner/src/server/views/partials/summary-row.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro summaryRow(item, notSuppliedText, changeText) %}
{% macro summaryRow(item, notSuppliedText, changeText, isReadOnlySummary) %}
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
{{item.label}}
Expand Down Expand Up @@ -47,9 +47,11 @@
{% endif %}
</dd>
<dd class="govuk-summary-list__actions">
{% if not isReadOnlySummary %}
<a class="govuk-link" href="{{item.url}}">
{{changeText}}<span class="govuk-visually-hidden"> {{item.label}}</span>
</a>
{% endif %}
</dd>
</div>
{% endmacro %}
20 changes: 16 additions & 4 deletions runner/src/server/views/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
{% from "components/checkboxes/macro.njk" import govukCheckboxes %}
{% extends 'layout.html' %}

{% set pageTitle = pageTitle if not isReadOnlySummary else "View your answers" %}

{% block beforeContent %}
{{ govukPhaseBanner({
tag: {
text: "beta"
},
html: "This is a new service."
}) }}
{% if isConfirmPageControllerRequest %}
{% if isConfirmPageControllerRequest or isReadOnlySummary %}
{{ govukBackLink({
href: backLink,
text: backLinkText
text: backLinkText if not isReadOnlySummary else "Back to application for funding overview"
}) }}
{% endif %}
{% endblock %}
Expand All @@ -24,6 +26,11 @@
{% if migrationBannerEnabled %}
{{migrationBanner()}}
{% endif %}

{% set hasMultipleSections = (details and details.length > 1 and details[0].items[0] | isArray) %}
{% if not hasMultipleSections %}
<span class="govuk-caption-l">{{ details[0].title }}</span>
{% endif %}
<h1 class="govuk-heading-l">{{ pageTitle }}</h1>
{% if callback and callback.message %}
<div class="govuk-inset-text">
Expand All @@ -35,8 +42,13 @@ <h1 class="govuk-heading-l">{{ pageTitle }}</h1>
Check your uploaded file is visible. If not, upload it again.
</div>
{% endif %}

{% if isReadOnlySummary %}
<p class="govuk-body">You cannot change your answers.</p>
{% endif %}

{% for detail in details %}
{{ summaryDetail(detail) }}
{{ summaryDetail(detail, isReadOnlySummary) }}
{% endfor %}

{% if fees and fees.details|length %}
Expand All @@ -49,7 +61,7 @@ <h2 class="govuk-heading-m">Fees</h2>
<p class="govuk-body">Total cost: £{{fees.total / 100 }}</p>
{% endif %}

{% if not result.error %}
{% if not result.error and not isReadOnlySummary %}
<form method="post" enctype="multipart/form-data" autocomplete="off" novalidate>
<input type="hidden" name="crumb" value="{{crumb}}"/>

Expand Down

0 comments on commit 7b0b049

Please sign in to comment.