Skip to content

Commit 73825d7

Browse files
committed
Handle none of the above for show live pages
When a route uses the none_of_the_above option as its trigger, we need to display "None of the above" rather than just using the answer_value for the condition.
1 parent 2eae377 commit 73825d7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

app/services/step_summary_card_service.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ def print_routes(conditions)
236236
caption = content_tag(:p, I18n.t("page_conditions.go_to_page", goto_page_question_number:, goto_page_question_text:), class: "govuk-body-s")
237237
end
238238

239-
answer_values = condition_group.map { |condition| "‘#{ActionController::Base.helpers.sanitize(condition.answer_value)}’" }
239+
answer_values = condition_group.map { |condition| "‘#{format_answer_value(condition.answer_value)}’" }
240240
formatted_list = html_unordered_list2(answer_values)
241241
safe_join([caption, formatted_list])
242242
}.join.html_safe
243243
end
244244

245245
def print_route(condition)
246-
answer_value = ActionController::Base.helpers.sanitize(condition.answer_value)
246+
answer_value = format_answer_value(condition.answer_value)
247247

248248
if condition.skip_to_end && condition.secondary_skip?
249249
I18n.t("page_conditions.condition_compact_html_secondary_skip_to_end_of_form")
@@ -266,6 +266,11 @@ def print_route(condition)
266266
end
267267
end
268268

269+
def format_answer_value(answer_value)
270+
answer_value = I18n.t("page_conditions.none_of_the_above") if answer_value == "none_of_the_above"
271+
ActionController::Base.helpers.sanitize(answer_value)
272+
end
273+
269274
def html_ordered_list(list_items)
270275
content_tag(:ol, html_list_item(list_items), class: ["govuk-list", "govuk-list--number"])
271276
end

0 commit comments

Comments
 (0)