Browse Source

GDPR declined page content

pull/201/head
baarkerlounger 4 years ago
parent
commit
033189f51e
  1. 3
      app/models/form/page.rb
  2. 6
      app/views/form/page.html.erb
  3. 3
      config/forms/2021_2022.json

3
app/models/form/page.rb

@ -1,6 +1,6 @@
class Form::Page class Form::Page
attr_accessor :id, :header, :description, :questions, :soft_validations, attr_accessor :id, :header, :description, :questions, :soft_validations,
:depends_on, :subsection :depends_on, :subsection, :hide_subsection_label
def initialize(id, hsh, subsection) def initialize(id, hsh, subsection)
@id = id @id = id
@ -8,6 +8,7 @@ class Form::Page
@description = hsh["description"] @description = hsh["description"]
@questions = hsh["questions"].map { |q_id, q| Form::Question.new(q_id, q, self) } @questions = hsh["questions"].map { |q_id, q| Form::Question.new(q_id, q, self) }
@depends_on = hsh["depends_on"] @depends_on = hsh["depends_on"]
@hide_subsection_label = hsh["hide_subsection_label"]
@soft_validations = hsh["soft_validations"]&.map { |sv_id, s| Form::Question.new(sv_id, s, self) } @soft_validations = hsh["soft_validations"]&.map { |sv_id, s| Form::Question.new(sv_id, s, self) }
@subsection = subsection @subsection = subsection
end end

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

@ -16,11 +16,17 @@
<div class="govuk-grid-column-two-thirds-from-desktop"> <div class="govuk-grid-column-two-thirds-from-desktop">
<% if @page.header.present? %> <% if @page.header.present? %>
<h1 class="govuk-heading-l"> <h1 class="govuk-heading-l">
<% if !@page.hide_subsection_label %>
<span class="govuk-caption-l"><%= @subsection.label %></span> <span class="govuk-caption-l"><%= @subsection.label %></span>
<% end %>
<%= @page.header %> <%= @page.header %>
</h1> </h1>
<% end %> <% end %>
<% if @page.description.present? %>
<p class="govuk-body govuk-body-m"><%= @page.description.html_safe %></p>
<% end %>
<%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post" do |f| %> <%= form_with model: @case_log, url: form_case_log_path(@case_log), method: "post" do |f| %>
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<% @page.questions.map do |question| %> <% @page.questions.map do |question| %>

3
config/forms/2021_2022.json

@ -26,9 +26,10 @@
} }
}, },
"gdpr_declined": { "gdpr_declined": {
"hide_subsection_label": true,
"header": "You cannot use this service", "header": "You cannot use this service",
"hint_text": "", "hint_text": "",
"description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.", "description": "We cannot accept data about a tenant or buyer unless they’ve seen the <a class=\"govuk-link\" href=\"/files/privacy-notice.pdf\">DLUHC privacy notice</a>.<br /><br /><a class=\"govuk-link\" href=\"/logs\">Go to your logs</a>",
"questions": {}, "questions": {},
"depends_on": { "gdpr_acceptance": "No" } "depends_on": { "gdpr_acceptance": "No" }
}, },

Loading…
Cancel
Save