Browse Source

Enable section descriptions and add note about privacy notice

pull/271/head
Paul Robert Lloyd 3 years ago
parent
commit
eff1ca6250
  1. 1
      README.md
  2. 3
      app/models/form/section.rb
  3. 3
      app/views/case_logs/_tasklist.html.erb
  4. 1
      config/forms/2021_2022.json
  5. 1
      spec/fixtures/forms/2021_2022.json
  6. 4
      spec/models/form/section_spec.rb

1
README.md

@ -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]": {
"label": String,

3
app/models/form/section.rb

@ -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

3
app/views/case_logs/_tasklist.html.erb

@ -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) %>

1
config/forms/2021_2022.json

@ -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.",
"subsections": {
"household_characteristics": {
"label": "Household characteristics",

1
spec/fixtures/forms/2021_2022.json vendored

@ -3,6 +3,7 @@
"sections": {
"household": {
"label": "About the household",
"description": "Make sure the tenant has seen the privacy notice.",
"subsections": {
"household_characteristics": {
"label": "Household characteristics",

4
spec/models/form/section_spec.rb

@ -16,6 +16,10 @@ RSpec.describe Form::Section, type: :model do
expect(section.label).to eq("About the household")
end
it "has a description" do
expect(section.description).to eq("Make sure the tenant has seen the privacy notice.")
end
it "has subsections" do
expected_subsections = %w[household_characteristics household_needs]
expect(section.subsections.map(&:id)).to eq(expected_subsections)

Loading…
Cancel
Save