Browse Source
* Allow clearing all error questions * Update setup question link * Update clear all to ignore setup questions * Update correct_validation_action_href * Extract some vriablespull/2484/head
9 changed files with 209 additions and 20 deletions
@ -0,0 +1,11 @@ |
|||||||
|
module CheckErrorsHelper |
||||||
|
include GovukLinkHelper |
||||||
|
|
||||||
|
def check_errors_answer_text(question, log) |
||||||
|
question.displayed_as_answered?(log) ? "Change" : "Answer" |
||||||
|
end |
||||||
|
|
||||||
|
def check_errors_answer_link(log, question, page, applicable_questions) |
||||||
|
send("#{log.model_name.param_key}_#{question.page.id}_path", log, referrer: "check_errors", original_page_id: page.id, related_question_ids: applicable_questions.map(&:id)) |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,32 @@ |
|||||||
|
<% content_for :before_content do %> |
||||||
|
<% content_for :title, "Are you sure you want to clear all?" %> |
||||||
|
<% end %> |
||||||
|
|
||||||
|
<div class="govuk-grid-row"> |
||||||
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
||||||
|
<h1 class="govuk-heading-xl"> |
||||||
|
<%= content_for(:title) %> |
||||||
|
</h1> |
||||||
|
<p class="govuk-body">You've selected <%= @questions_to_clear.count %> answers to clear</p> |
||||||
|
|
||||||
|
<%= govuk_warning_text(text: "You will not be able to undo this action") %> |
||||||
|
<%= form_with model: @log, url: send("#{@log.model_name.param_key}_#{@page.id}_path", @log), method: "post", local: true do |f| %> |
||||||
|
|
||||||
|
<% @related_question_ids.each do |id| %> |
||||||
|
<%= f.hidden_field id, value: @log[id] %> |
||||||
|
<% end %> |
||||||
|
|
||||||
|
<%= f.hidden_field :clear_question_ids, value: @questions_to_clear %> |
||||||
|
<%= f.hidden_field :page, value: @page.id %> |
||||||
|
|
||||||
|
<div class="govuk-button-group"> |
||||||
|
<%= f.govuk_submit "Confirm and continue", name: "check_errors" %> |
||||||
|
<%= govuk_button_link_to( |
||||||
|
"Cancel", |
||||||
|
"javascript:history.back()", |
||||||
|
secondary: true, |
||||||
|
) %> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
Loading…
Reference in new issue