Browse Source

Move get answers with prefix and suffix to a question method;

\
pull/228/head
Kat 4 years ago
parent
commit
03a2329c63
  1. 5
      app/models/form/question.rb
  2. 4
      app/views/form/_check_answers_table.html.erb

5
app/models/form/question.rb

@ -33,6 +33,11 @@ class Form::Question
delegate :subsection, to: :page
delegate :form, to: :subsection
def get_answer_label(case_log)
answer = answer_label(case_log)
answer.present? ? [prefix, answer_label(case_log), suffix].join("") : ""
end
def answer_label(case_log)
return checkbox_answer_label(case_log) if type == "checkbox"
return case_log[id].strftime("%d %b %Y") if type == "date"

4
app/views/form/_check_answers_table.html.erb

@ -3,9 +3,7 @@
<%= question.check_answer_label.to_s.present? ? question.check_answer_label.to_s : question.header.to_s %>
<dt>
<dd class="govuk-summary-list__value">
<%= question.prefix.present? ? " " + question.prefix : ""%>
<%= question.answer_label(@case_log) %>
<%= question.suffix.present? ? " " + question.suffix : "" %><br/>
<%= question.get_answer_label(@case_log) %><br/>
<% question.get_inferred_answers(@case_log).each do |inferred_answer| %>
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span><br/>
<% end %>

Loading…
Cancel
Save