@ -107,6 +107,7 @@ The JSON should follow the structure:
"sections": {
"[snake_case_section_name_string]": {
"label": String,
"description": String,
"subsections": {
"[snake_case_subsection_name_string]": {
@ -1,9 +1,10 @@
class Form::Section
attr_accessor :id, :label, :subsections, :form
attr_accessor :id, :label, :description, :subsections, :form
def initialize(id, hsh, form)
@id = id
@label = hsh["label"]
@description = hsh["description"]
@form = form
@subsections = hsh["subsections"].map { |s_id, s| Form::Subsection.new(s_id, s, self) }
end
@ -6,6 +6,9 @@
<%= section.label %>
</span>
</h2>
<% if section.description %>
<p class="govuk-body"><%= section.description.html_safe %></p>
<% end %>
<ul class="app-task-list__items">
<% section.subsections.map do |subsection| %>
<% subsection_status = subsection.status(@case_log) %>
@ -173,6 +173,7 @@
},
"household": {
"label": "About the household",
"description": "Make sure the tenant has seen <a class=\"govuk-link\" href=\"/files/privacy-notice.pdf\">the Department for Levelling Up, Housing & Communities (DLUHC) privacy notice</a> before completing this section.",
"household_characteristics": {
"label": "Household characteristics",
@ -3,6 +3,7 @@
"description": "Make sure the tenant has seen the privacy notice.",
@ -16,6 +16,10 @@ RSpec.describe Form::Section, type: :model do
expect(section.label).to eq("About the household")
it "has a description" do
expect(section.description).to eq("Make sure the tenant has seen the privacy notice.")
it "has subsections" do
expected_subsections = %w[household_characteristics household_needs]
expect(section.subsections.map(&:id)).to eq(expected_subsections)