Browse Source

Fix header styling (#107)

pull/95/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
8d0ff38e51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      app/controllers/case_logs_controller.rb
  2. 2
      app/views/case_logs/edit.html.erb
  3. 2
      app/views/case_logs/index.html.erb
  4. 2
      app/views/form/_checkbox_question.html.erb
  5. 2
      app/views/form/_date_question.html.erb
  6. 2
      app/views/form/_numeric_question.html.erb
  7. 2
      app/views/form/_radio_question.html.erb
  8. 2
      app/views/form/_select_question.html.erb
  9. 2
      app/views/form/_text_question.html.erb
  10. 7
      app/views/form/page.html.erb

6
app/controllers/case_logs_controller.rb

@ -64,7 +64,8 @@ class CaseLogsController < ApplicationController
redirect_path = form.next_page_redirect_path(page, @case_log) redirect_path = form.next_page_redirect_path(page, @case_log)
redirect_to(send(redirect_path, @case_log)) redirect_to(send(redirect_path, @case_log))
else else
render "form/page", locals: { form: form, page: page }, status: :unprocessable_entity subsection = form.subsection_for_page(page)
render "form/page", locals: { form: form, page: page, subsection: subsection.label }, status: :unprocessable_entity
end end
end end
@ -92,7 +93,8 @@ class CaseLogsController < ApplicationController
form.pages.map do |page| form.pages.map do |page|
define_method(page.id) do |_errors = {}| define_method(page.id) do |_errors = {}|
@case_log = CaseLog.find(params[:case_log_id]) @case_log = CaseLog.find(params[:case_log_id])
render "form/page", locals: { form: form, page: page } subsection = form.subsection_for_page(page)
render "form/page", locals: { form: form, page: page, subsection: subsection.label }
end end
end end

2
app/views/case_logs/edit.html.erb

@ -1,7 +1,7 @@
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<h1 class="govuk-heading-xl">Tasklist for log <h1 class="govuk-heading-l">Tasklist for log
<%= @case_log.id %></h1> <%= @case_log.id %></h1>
<h2 class="govuk-heading-s govuk-!-margin-bottom-2">This submission is <h2 class="govuk-heading-s govuk-!-margin-bottom-2">This submission is

2
app/views/case_logs/index.html.erb

@ -1,6 +1,6 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-full"> <div class="govuk-grid-column-full">
<h1 class="govuk-heading-xl">Your logs</h1> <h1 class="govuk-heading-l">Your logs</h1>
</div> </div>
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">

2
app/views/form/_checkbox_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_check_boxes_fieldset question.id.to_sym, <%= f.govuk_check_boxes_fieldset question.id.to_sym,
legend: { text: question.header.html_safe, size: "l" }, legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
hint: { text: question.hint_text } do %> hint: { text: question.hint_text } do %>
<% question.answer_options.map do |key, val| %> <% question.answer_options.map do |key, val| %>

2
app/views/form/_date_question.html.erb

@ -1,6 +1,6 @@
<%= f.govuk_date_field question.id.to_sym, <%= f.govuk_date_field question.id.to_sym,
hint: { text: question.hint_text }, hint: { text: question.hint_text },
legend: { text: question.header.html_safe, size: "l"}, legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
width: 20, width: 20,
**stimulus_html_attributes(question) **stimulus_html_attributes(question)
%> %>

2
app/views/form/_numeric_question.html.erb

@ -1,6 +1,6 @@
<%= f.govuk_number_field question.id.to_sym, <%= f.govuk_number_field question.id.to_sym,
hint: { text: question.hint_text }, hint: { text: question.hint_text },
label: { text: question.header.html_safe, size: "l"}, label: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
min: question.min, max: question.max, step: question.step, min: question.min, max: question.max, step: question.step,
width: 20, :readonly => question.read_only?, width: 20, :readonly => question.read_only?,
**stimulus_html_attributes(question) **stimulus_html_attributes(question)

2
app/views/form/_radio_question.html.erb

@ -1,5 +1,5 @@
<%= f.govuk_radio_buttons_fieldset question.id.to_sym, <%= f.govuk_radio_buttons_fieldset question.id.to_sym,
legend: { text: question.header.html_safe, size: "l" }, legend: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
hint: { text: question.hint_text }, hint: { text: question.hint_text },
small: (question.answer_options.size > 5) do %> small: (question.answer_options.size > 5) do %>

2
app/views/form/_select_question.html.erb

@ -3,6 +3,6 @@
answers, answers,
:name, :name,
:name, :name,
label: { text: question.header}, label: { text: question.header, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
hint: { text: question.hint_text } hint: { text: question.hint_text }
%> %>

2
app/views/form/_text_question.html.erb

@ -1,6 +1,6 @@
<%= f.govuk_text_field question.id.to_sym, <%= f.govuk_text_field question.id.to_sym,
hint: { text: question.hint_text }, hint: { text: question.hint_text },
label: { text: question.header.html_safe, size: "l"}, label: { text: question.header.html_safe, size: page_header.nil? ? "l" : "m", tag: page_header.nil? ? "h2" : "h1" },
width: 20, width: 20,
**stimulus_html_attributes(question) **stimulus_html_attributes(question)
%> %>

7
app/views/form/page.html.erb

@ -5,8 +5,11 @@
<%= turbo_frame_tag "case_log_form", target: "_top" do %> <%= turbo_frame_tag "case_log_form", target: "_top" do %>
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<span class="govuk-caption-l">
<%= subsection %>
</span>
<% if page.header.present? %> <% if page.header.present? %>
<h1 class="govuk-heading-xl"> <h1 class="govuk-heading-l">
<%= page.header %> <%= page.header %>
</h1> </h1>
<% end %> <% end %>
@ -14,7 +17,7 @@
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<% page.questions.map do |question| %> <% page.questions.map do |question| %>
<div id=<%= question.id + "_div " %><%= display_question_key_div(page, question) %> > <div id=<%= question.id + "_div " %><%= display_question_key_div(page, question) %> >
<%= render partial: "form/#{question.type}_question", locals: { question: question, f: f } %> <%= render partial: "form/#{question.type}_question", locals: { question: question, page_header: page.header, f: f } %>
</div> </div>
<% end %> <% end %>

Loading…
Cancel
Save