Skip to content

Commit

Permalink
Add tags and hide change links
Browse files Browse the repository at this point in the history
  • Loading branch information
albertkol committed Jan 30, 2025
1 parent e120f22 commit 7d6bbd6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ export class SummaryPageController extends PageController {
viewModel.backLink = state.callback?.returnUrl;
}

viewModel.isResubmission = false
if (state["metadata"] && state["metadata"]["is_resubmission"]) {
viewModel.isResubmission = state["metadata"]["is_resubmission"];
}

viewModel.changeRequestsQuestionIDs = [];
if (state["metadata"] && state["metadata"]["change_requests"]) {
for (let componentName in state["metadata"]["change_requests"]) {
viewModel.changeRequestsQuestionIDs.push(componentName);
}
}

/**
* iterates through the errors. If there are errors, a user will be redirected to the page
* with the error with returnUrl=`/${model.basePath}/<last page that shows summary details>` in the URL query parameter.
Expand Down
4 changes: 2 additions & 2 deletions runner/src/server/views/partials/summary-detail.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% from "./summary-row.html" import summaryRow %}

{% macro summaryDetail(data, isReadOnlySummary=false) %}
{% macro summaryDetail(data, isReadOnlySummary=false, isResubmission=false, changeRequestsQuestionIDs=[]) %}
{% set isRepeatableSection = (data.items[0] | isArray) %}
{% if not isRepeatableSection %}
<h2 class="govuk-heading-m">{{data.title}}</h2>
Expand All @@ -17,7 +17,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, isReadOnlySummary) }}
{{ summaryRow(item, data.notSuppliedText, data.changeText, isReadOnlySummary, isResubmission, changeRequestsQuestionIDs) }}
{% endif %}
{% endif %}
{% endfor %}
Expand Down
13 changes: 8 additions & 5 deletions 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, isReadOnlySummary=false) %}
{% macro summaryRow(item, notSuppliedText, changeText, isReadOnlySummary=false, isResubmission=false, changeRequestsQuestionIDs=[]) %}
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
{{item.label}}
Expand Down Expand Up @@ -39,10 +39,13 @@
{% 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>
{% if not isReadOnlySummary and (not isResubmission or (isResubmission and item.name in changeRequestsQuestionIDs)) %}
{% if (isResubmission and item.name in changeRequestsQuestionIDs) %}
<span class="govuk-tag govuk-tag--orange govuk-!-margin-right-2">TO REVIEW</span>
{% endif %}
<a class="govuk-link" href="{{item.url}}">
{{changeText}}<span class="govuk-visually-hidden"> {{item.label}}</span>
</a>
{% endif %}
</dd>
</div>
Expand Down
2 changes: 1 addition & 1 deletion runner/src/server/views/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h1 class="govuk-heading-l">
{% endif %}

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

{% if fees and fees.details|length %}
Expand Down

0 comments on commit 7d6bbd6

Please sign in to comment.