Browse Source

CLDC-1980: copy setup from CLDC-4200

pull/3172/head
Nat Dean-Lewis 1 week ago
parent
commit
e68a2c8626
  1. 4
      app/components/check_answers_summary_list_card_component.html.erb
  2. 5
      app/components/check_answers_summary_list_card_component.rb
  3. 2
      app/models/form/question.rb

4
app/components/check_answers_summary_list_card_component.html.erb

@ -1,8 +1,8 @@
<% if applicable_questions.first %>
<div class="govuk-summary-card govuk-!-margin-bottom-6">
<% if applicable_questions.first.check_answers_card_number != 0 && applicable_questions.first.check_answers_card_number.present? %>
<% if check_answers_card_label(applicable_questions.first).present? %>
<div class="govuk-summary-card__title-wrapper">
<h3 class="govuk-summary-card__title"><%= check_answers_card_title(applicable_questions.first) %></h3>
<h3 class="govuk-summary-card__title"><%= check_answers_card_label(applicable_questions.first) %></h3>
</div>
<% end %>

5
app/components/check_answers_summary_list_card_component.rb

@ -22,7 +22,10 @@ class CheckAnswersSummaryListCardComponent < ViewComponent::Base
[question.question_number_string, question.check_answer_label.to_s.presence || question.header.to_s].compact.join(" - ")
end
def check_answers_card_title(question)
def check_answers_card_label(question)
return question.check_answers_card_title if question.check_answers_card_title.present?
return unless question.check_answers_card_number.present? && question.check_answers_card_number != 0
return "Lead tenant" if question.form.type == "lettings" && question.check_answers_card_number == 1
return "Buyer #{question.check_answers_card_number}" if question.check_answers_card_number <= number_of_buyers

2
app/models/form/question.rb

@ -6,7 +6,7 @@ class Form::Question
:conditional_for, :readonly, :answer_options, :page,
:inferred_answers, :hidden_in_check_answers, :inferred_check_answers_value,
:top_guidance_partial, :bottom_guidance_partial, :prefix, :suffix,
:requires_js, :fields_added, :derived, :check_answers_card_number,
:requires_js, :fields_added, :derived, :check_answers_card_number, :check_answers_card_title,
:unresolved_hint_text, :question_number, :hide_question_number_on_page,
:plain_label, :error_label, :strip_commas

Loading…
Cancel
Save