diff --git a/app/javascript/stylesheets/print.scss b/app/javascript/stylesheets/print.scss index 633d650df..31b110651 100644 --- a/app/javascript/stylesheets/print.scss +++ b/app/javascript/stylesheets/print.scss @@ -6,6 +6,13 @@ border: 1px solid gray; } +.one-grid { + display: grid; + grid-template-columns: auto; + font-size: 10px; + grid-auto-columns: 1fr 200px; +} + .two-grid { display: grid; grid-template-columns: auto auto; @@ -13,6 +20,13 @@ grid-auto-columns: 1fr 200px; } +.four-grid { + display: grid; + grid-template-columns: auto auto auto auto; + font-size: 10px; + grid-auto-columns: 1fr 200px; +} + .three-grid { display: grid; grid-template-columns: auto auto auto; @@ -24,6 +38,8 @@ font-size: small; margin-bottom: 0; margin-top: 5px; + background-color: #1d70b8; + color: white; } .govuk-body{ diff --git a/app/views/form/print.html.erb b/app/views/form/print.html.erb index b722de18f..9f14a9753 100644 --- a/app/views/form/print.html.erb +++ b/app/views/form/print.html.erb @@ -3,11 +3,11 @@ <%= form_with do |f| %> <% @form.all_subsections.each do |subsection_name, subsection_content| %>

<%= subsection_content["label"] %>

- <% large_answers = @form.questions_for_subsection(subsection_name).any? {|key, info| info["type"]== 'checkbox' || info["type"]== 'radio' && info["answer_options"].keys.length > 4} ? "two-grid" : "three-grid" %> + <% large_answers = @form.questions_for_subsection(subsection_name).any? {|key, info| info["type"]== 'checkbox' || info["type"]== 'radio' && info["answer_options"].keys.length > 4} ? "one-grid" : "three-grid" %>
<% @form.questions_for_subsection(subsection_name).each_with_index do |question, index| %>
- <%= render partial: "form/print/#{question[1]["print_type"] || question[1]["type"]}_question", locals: { question_key: question[0].to_sym, question: question[1], index: index, f: f } %> + <%= render partial: "form/print/#{question[1]["print_type"] || question[1]["type"]}_question", locals: { question_key: question[0].to_sym, question: question[1], index: index, f: f, outer_grid: large_answers } %>
<% end %>
diff --git a/app/views/form/print/_checkbox_question.html.erb b/app/views/form/print/_checkbox_question.html.erb index fb5765d73..4136f4e59 100644 --- a/app/views/form/print/_checkbox_question.html.erb +++ b/app/views/form/print/_checkbox_question.html.erb @@ -1,23 +1 @@ -
- - <%= question["header"].html_safe.present? ? question["header"].html_safe : "missing question header"%> - -
-
-
- <% question["answer_options"].each do |index, answer_option| %> - <% if index.to_i.even? %> - -
- <% end %> - <%end %> -
-
- <% question["answer_options"].each do |index, answer_option| %> - <% if !index.to_i.even? %> - -
- <% end %> - <%end %> -
-
+<%= render partial: "form/print/radio_question", locals: { question_key: question_key, question: question, index: index, f: f, outer_grid: outer_grid } %> diff --git a/app/views/form/print/_people_table.html.erb b/app/views/form/print/_people_table.html.erb new file mode 100644 index 000000000..120fae45b --- /dev/null +++ b/app/views/form/print/_people_table.html.erb @@ -0,0 +1,10 @@ +
+ + <%= question["header"].html_safe.present? ? question["header"].html_safe : "missing question header"%>
+
+
+
+
+
+
+
diff --git a/app/views/form/print/_radio_question.html.erb b/app/views/form/print/_radio_question.html.erb index fb5765d73..0a84b8f5c 100644 --- a/app/views/form/print/_radio_question.html.erb +++ b/app/views/form/print/_radio_question.html.erb @@ -3,21 +3,59 @@ <%= question["header"].html_safe.present? ? question["header"].html_safe : "missing question header"%> -
-
- <% question["answer_options"].each do |index, answer_option| %> - <% if index.to_i.even? %> - -
- <% end %> - <%end %> +<%if outer_grid == 'three-grid' %> +
+
+ <% question["answer_options"].each_with_index do |answer_option, index| %> + <% if index.to_i.even? %> + +
+ <% end %> + <%end %> +
+
+ <% question["answer_options"].each_with_index do |answer_option, index| %> + <% if !index.to_i.even?%> + +
+ <% end %> + <%end %> +
-
- <% question["answer_options"].each do |index, answer_option| %> - <% if !index.to_i.even? %> - -
- <% end %> - <%end %> + +<% else %> +
+
+ <% question["answer_options"].each_with_index do |answer_option, index| %> + <% if index.to_i.even? && index.to_i%4 != 0 %> + +
+ <% end %> + <%end %> +
+
+ <% question["answer_options"].each_with_index do |answer_option, index| %> + <% if !index.to_i.even? && index.to_i%3 != 0%> + +
+ <% end %> + <%end %> +
+
+ <% question["answer_options"].each_with_index do |answer_option, index| %> + <% if index.to_i.even? && index.to_i%4 == 0%> + +
+ <% end %> + <%end %> +
+
+ <% question["answer_options"].each_with_index do |answer_option, index| %> + <% if !index.to_i.even? && index.to_i%3 == 0%> + +
+ <% end %> + <%end %> +
-
+<% end %> diff --git a/app/views/form/print/_select_question.html.erb b/app/views/form/print/_select_question.html.erb index 55deda8ef..4136f4e59 100644 --- a/app/views/form/print/_select_question.html.erb +++ b/app/views/form/print/_select_question.html.erb @@ -1,11 +1 @@ -
- - <%= question["header"].html_safe.present? ? question["header"].html_safe : "missing question header"%> - -
-
- <% question["answer_options"].each do |index, answer_option| %> - - - <%end %> -
+<%= render partial: "form/print/radio_question", locals: { question_key: question_key, question: question, index: index, f: f, outer_grid: outer_grid } %>