From d3a893522d60c7a7a77ae00a71bd3e9c2c04f936 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:47:12 +0000 Subject: [PATCH] CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page --- app/views/start/guidance.html.erb | 68 ++++++++++++++++++++++++++ app/views/start/index.html.erb | 1 + config/routes.rb | 1 + spec/requests/start_controller_spec.rb | 56 +++++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 app/views/start/guidance.html.erb create mode 100644 spec/requests/start_controller_spec.rb diff --git a/app/views/start/guidance.html.erb b/app/views/start/guidance.html.erb new file mode 100644 index 000000000..127b56b3b --- /dev/null +++ b/app/views/start/guidance.html.erb @@ -0,0 +1,68 @@ +

+ Guidance for submitting social housing lettings and sales data +

+ +
+
+

This page includes details of when a CORE log is and is not required, what to do if a tenant or buyer is reluctant to answer questions in a log, and other information about submitting logs using CORE.

+ <%= govuk_accordion do |accordion| %> + <%= accordion.with_section(heading_text: "How to create logs", expanded: true) do %> +

There are 2 ways to create logs on CORE.

+

You can create logs one at a time by answering questions using the online form. Click the “Create a new log” button on the logs page to create logs this way.

+

You can also create many logs at once by uploading a CSV file. This might be faster than creating logs individually if your organisation has its own database and a way to export the data. Click the “Upload logs in bulk” button on the logs page to create logs this way. For more information, <%= govuk_link_to "read the full guidance on bulk upload", bulk_upload_lettings_log_path(id: "guidance", form: { year: current_collection_start_year }) %>.

+

Once you have created and completed a log, there is nothing more you need to do to submit the data.

+ <% end %> + + <%= accordion.with_section(heading_text: "What scenarios require a new log?") do %> +

For general needs, you should complete a log for each new tenancy intended to last 2 years or more if it is social rent or affordable rent, or of any length if it is intermediate rent.

+

For supported housing, you should complete a log for each new letting of any length.

+

If a new tenancy agreement is signed, create a new log.

+ <% end %> + + <%= accordion.with_section(heading_text: "Types of lettings you should create logs for") do %> +

You’ll need to create a log for:

+ + <% end %> + + <%= accordion.with_section(heading_text: "Types of lettings you should not create logs for") do %> +

You don’t need to create a log for:

+ + <% end %> + + <%= accordion.with_section(heading_text: "What if someone is reluctant to answer any questions?") do %> +

If a tenant or buyer is reluctant to answer questions as part of a log, you should explain that:

+ +

If a tenant or buyer is still unwilling or unable to answer questions, select the ‘Don’t know’ or ‘Tenant/person prefers not to say’ options.

+ <% end %> + <% end %> +
+
diff --git a/app/views/start/index.html.erb b/app/views/start/index.html.erb index 3c10232d2..d6ec6d392 100644 --- a/app/views/start/index.html.erb +++ b/app/views/start/index.html.erb @@ -20,6 +20,7 @@

Use your account details to sign in.

If you need to set up a new account, speak to your organisation’s CORE data coordinator. If you don’t know who that is, <%= govuk_link_to("contact the helpdesk", GlobalConstants::HELPDESK_URL) %>.

You can <%= govuk_mail_to("dluhc.digital-services@levellingup.gov.uk", "request an account", subject: "CORE: Request a new account") %> if your organisation doesn’t have one.

+

<%= govuk_link_to guidance_path do %>Guidance for submitting social housing lettings and sales data (CORE)<% end %>

diff --git a/config/routes.rb b/config/routes.rb index af0b95d07..94626f34d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -30,6 +30,7 @@ Rails.application.routes.draw do resource :cookies, only: %i[show update] root to: "start#index" + get "/guidance", to: "start#guidance" get "/logs", to: redirect("lettings-logs") get "/accessibility-statement", to: "content#accessibility_statement" diff --git a/spec/requests/start_controller_spec.rb b/spec/requests/start_controller_spec.rb new file mode 100644 index 000000000..f24249749 --- /dev/null +++ b/spec/requests/start_controller_spec.rb @@ -0,0 +1,56 @@ +require "rails_helper" + +RSpec.describe StartController, type: :request do + let(:user) { create(:user) } + let(:headers) { { "Accept" => "text/html" } } + let(:page) { Capybara::Node::Simple.new(response.body) } + let(:notify_client) { instance_double(Notifications::Client) } + let(:devise_notify_mailer) { DeviseNotifyMailer.new } + + before do + allow(DeviseNotifyMailer).to receive(:new).and_return(devise_notify_mailer) + allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client) + allow(notify_client).to receive(:send_email).and_return(true) + end + + describe "GET" do + context "when the user is not signed in" do + it "routes user to the start in page" do + get "/", headers: headers, params: {} + expect(path).to include("/") + expect(page).to have_content("Start now") + end + end + + context "when the user is signed in" do + before do + sign_in user + end + + it "routes user to the home page" do + get "/", headers:, params: {} + expect(page).to have_content("Welcome back") + end + end + end + + describe "guidance page" do + context "when the user is not signed in" do + it "routes user to the guidance page" do + get "/guidance", headers:, params: {} + expect(page).to have_content("Guidance for submitting social housing lettings and sales data") + end + end + + context "when the user is signed in" do + before do + sign_in user + end + + it "routes user to the guidance page" do + get "/guidance", headers:, params: {} + expect(page).to have_content("Guidance for submitting social housing lettings and sales data") + end + end + end +end