Skip to content

Commit

Permalink
make personal details a partial, allowing for different heading sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
alkesh committed Sep 26, 2024
1 parent 77c8d27 commit 098322b
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 70 deletions.
70 changes: 70 additions & 0 deletions app/views/claims/_personal_details_page.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<% content_for(:page_title, page_title(t("questions.personal_details"), journey: current_journey_routing_name, show_error: @form.errors.any?)) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-<%= heading_size %>">
<%= t("questions.personal_details") %>
</h1>

<% if @form.show_name_section? %>
<div class="govuk-form-group govuk-!-padding-bottom-6">
<%= f.govuk_fieldset legend: {
text: "What is your full name?",
tag: "h2",
size: subheading_size
} do %>
<%= f.govuk_text_field :first_name,
label: { text: "First name" },
autocomplete: "given-name"
%>

<%= f.govuk_text_field :middle_name,
label: { text: "Middle names" },
autocomplete: "additional-name"
%>

<%= f.govuk_text_field :surname,
label: { text: "Last name" },
autocomplete: "family-name"
%>
<% end %>
</div>
<% end %>

<% if @form.show_date_of_birth_section? %>
<div class="govuk-!-padding-bottom-6">
<%= f.govuk_date_field :date_of_birth,
date_of_birth: true,
legend: {
text: "What is your date of birth?",
tag: "h2",
size: subheading_size
},
hint: { text: "For example, 31 03 1980. We need this information to verify your identity." } %>
</div>
<% end %>

<% if @form.show_nino_section? %>
<div class="govuk-!-padding-bottom-6">
<%= f.govuk_text_field :national_insurance_number,
width: 10,
spellcheck: false,
autocomplete: "off",
label: {
text: t("questions.national_insurance_number"),
size: subheading_size,
tag: "h2"
},
hint: -> do %>
It’s on your National Insurance card, benefit letter, payslip or P60. For example ‘QQ123456C’.
<% end %>
</div>
<% end %>

<%= f.govuk_submit "Continue" %>
<% end %>
</div>
</div>
71 changes: 1 addition & 70 deletions app/views/claims/personal_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,70 +1 @@
<% content_for(:page_title, page_title(t("questions.personal_details"), journey: current_journey_routing_name, show_error: @form.errors.any?)) %>

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= form_for @form, url: claim_path(current_journey_routing_name), builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %>
<%= f.govuk_error_summary %>

<h1 class="govuk-heading-xl">
<%= t("questions.personal_details") %>
</h1>

<% if @form.show_name_section? %>
<div class="govuk-form-group govuk-!-padding-bottom-6">
<%= f.govuk_fieldset legend: {
text: "What is your full name?",
tag: "h2",
size: "l"
} do %>
<%= f.govuk_text_field :first_name,
label: { text: "First name" },
autocomplete: "given-name"
%>

<%= f.govuk_text_field :middle_name,
label: { text: "Middle names" },
autocomplete: "additional-name"
%>

<%= f.govuk_text_field :surname,
label: { text: "Last name" },
autocomplete: "family-name"
%>
<% end %>
</div>
<% end %>

<% if @form.show_date_of_birth_section? %>
<div class="govuk-!-padding-bottom-6">
<%= f.govuk_date_field :date_of_birth,
date_of_birth: true,
legend: {
text: "What is your date of birth?",
tag: "h2",
size: "l"
},
hint: { text: "For example, 31 03 1980. We need this information to verify your identity." } %>
</div>
<% end %>

<% if @form.show_nino_section? %>
<div class="govuk-!-padding-bottom-6">
<%= f.govuk_text_field :national_insurance_number,
width: 10,
spellcheck: false,
autocomplete: "off",
label: {
text: t("questions.national_insurance_number"),
size: "l",
tag: "h2"
},
hint: -> do %>
It’s on your National Insurance card, benefit letter, payslip or P60. For example ‘QQ123456C’.
<% end %>
</div>
<% end %>

<%= f.govuk_submit "Continue" %>
<% end %>
</div>
</div>
<%= render "personal_details_page", heading_size: "xl", subheading_size: "l" %>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%= render "personal_details_page", heading_size: "l", subheading_size: "m" %>

0 comments on commit 098322b

Please sign in to comment.