From c912696e143003aee6d43a3f814ddcdb8f97c4f7 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:28:30 +0000 Subject: [PATCH] CLDC-2253 Add collection resources (#2120) * Update collection resources, add to homepage * Add guidance link to an empty page * Update headings * Rebase fix * Update title * Update file names * Add section break --- app/frontend/styles/_document-list.scss | 2 +- app/views/home/index.html.erb | 5 + .../layouts/_collection_resources.html.erb | 115 ++++++------------ app/views/organisations/show.html.erb | 4 - app/views/start/index.html.erb | 7 +- .../requests/organisations_controller_spec.rb | 36 ------ spec/requests/start_controller_spec.rb | 29 +++++ 7 files changed, 81 insertions(+), 117 deletions(-) diff --git a/app/frontend/styles/_document-list.scss b/app/frontend/styles/_document-list.scss index 47936a365..e8cef0625 100644 --- a/app/frontend/styles/_document-list.scss +++ b/app/frontend/styles/_document-list.scss @@ -12,7 +12,7 @@ } .app-document-list__item-title { - @include govuk-font($size: 16, $weight: "bold"); + @include govuk-font($size: 16); margin: 0 0 govuk-spacing(1); } diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index e691b3e5b..7469ed18f 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -1 +1,6 @@

<%= "Welcome back, #{@current_user.name}" %>

+
+
+ <%= render partial: "layouts/collection_resources" %> +
+
diff --git a/app/views/layouts/_collection_resources.html.erb b/app/views/layouts/_collection_resources.html.erb index e2d56e4a5..0c084596e 100644 --- a/app/views/layouts/_collection_resources.html.erb +++ b/app/views/layouts/_collection_resources.html.erb @@ -1,94 +1,59 @@ -
+<% if current_user %> +

Collection resources

+

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

+<% else %>

Collection resources

-

For lettings starting during 1 April 2023 to 31 March 2024 and sales completing during the same period, use the 2023/24 forms.

- +<% end %> +

Use the 2023 to 2024 forms for lettings that start and sales that complete between 1 April 2023 and 31 March 2024.

+<%= govuk_tabs(title: "Collection resources") do |c| %> <% if FormHandler.instance.lettings_form_for_start_year(2023) && FormHandler.instance.lettings_form_for_start_year(2023).edit_end_date > Time.zone.today %> -

Lettings 2023/24

- <%= render DocumentListComponent.new(items: [ + <% c.with_tab(label: "Lettings 2023/24") do %> + <%= render DocumentListComponent.new(items: [ { - name: "Lettings log for tenants (2023/24)", + name: "Download the lettings log for tenants (2023 to 2024)", href: download_23_24_lettings_form_path, metadata: file_type_size_and_pages("2023_24_lettings_paper_form.pdf", number_of_pages: 8), }, { - name: "Lettings bulk upload template (2023/24) – New question ordering", + name: "Download the lettings bulk upload template (2023 to 2024) – New question ordering", href: download_23_24_lettings_bulk_upload_template_path, metadata: file_type_size_and_pages("bulk-upload-lettings-template-2023-24.xlsx"), }, { - name: "Lettings bulk upload template (2023/24)", + name: "Download the lettings bulk upload template (2023 to 2024) – Legacy version", href: download_23_24_lettings_bulk_upload_legacy_template_path, metadata: file_type_size_and_pages("bulk-upload-lettings-legacy-template-2023-24.xlsx"), }, { - name: "Lettings bulk upload specification (2023/24)", + name: "Download the lettings bulk upload specification (2023 to 2024)", href: download_23_24_lettings_bulk_upload_specification_path, metadata: file_type_size_and_pages("bulk-upload-lettings-specification-2023-24.xlsx"), }, - ]) %> - -

Sales 2023/24

- <%= render DocumentListComponent.new(items: [ - { - name: "Sales log for buyers (2023/24)", - href: download_23_24_sales_form_path, - metadata: file_type_size_and_pages("2023_24_sales_paper_form.pdf", number_of_pages: 8), - }, - { - name: "Sales bulk upload template (2023/24) – New question ordering", - href: download_23_24_sales_bulk_upload_template_path, - metadata: file_type_size_and_pages("bulk-upload-sales-template-2023-24.xlsx"), - }, - { - name: "Sales bulk upload template (2023/24)", - href: download_23_24_sales_bulk_upload_legacy_template_path, - metadata: file_type_size_and_pages("bulk-upload-sales-legacy-template-2023-24.xlsx"), - }, - { - name: "Sales bulk upload specification (2023/24)", - href: download_23_24_sales_bulk_upload_specification_path, - metadata: file_type_size_and_pages("bulk-upload-sales-specification-2023-24.xlsx"), - }, - ]) %> - <% end %> - - <% if FormHandler.instance.lettings_form_for_start_year(2022) && FormHandler.instance.lettings_form_for_start_year(2022).edit_end_date > Time.zone.today %> -

Lettings 2022/23

- <%= render DocumentListComponent.new(items: [ - { - name: "Lettings log for tenants (2022/23)", - href: download_22_23_lettings_form_path, - metadata: file_type_size_and_pages("2022_23_lettings_paper_form.pdf", number_of_pages: 4), - }, - { - name: "Lettings bulk upload template (2022/23)", - href: download_22_23_lettings_bulk_upload_template_path, - metadata: file_type_size_and_pages("bulk-upload-lettings-template-2022-23.xlsx"), - }, - { - name: "Lettings bulk upload specification (2022/23)", - href: download_22_23_lettings_bulk_upload_specification_path, - metadata: file_type_size_and_pages("bulk-upload-lettings-specification-2022-23.xlsx"), - }, - ]) %> - -

Sales 2022/23

- <%= render DocumentListComponent.new(items: [ - { - name: "Sales log for buyers (2022/23)", - href: download_22_23_sales_form_path, - metadata: file_type_size_and_pages("2022_23_sales_paper_form.pdf", number_of_pages: 5), - }, - { - name: "Sales bulk upload template (2022/23)", - href: download_22_23_sales_bulk_upload_template_path, - metadata: file_type_size_and_pages("bulk-upload-sales-template-2022-23.xlsx"), - }, - { - name: "Sales bulk upload specification (2022/23)", - href: download_22_23_sales_bulk_upload_specification_path, - metadata: file_type_size_and_pages("bulk-upload-sales-template-2022-23.xlsx"), - }, - ]) %> + ]) %> + <% end %> + <% c.with_tab(label: "Sales 2023/24") do %> + <%= render DocumentListComponent.new(items: [ + { + name: "Download the sales log for buyers (2023 to 2024)", + href: download_23_24_sales_form_path, + metadata: file_type_size_and_pages("2023_24_sales_paper_form.pdf", number_of_pages: 8), + }, + { + name: "Download the sales bulk upload template (2023 to 2024) – New question ordering", + href: download_23_24_sales_bulk_upload_template_path, + metadata: file_type_size_and_pages("bulk-upload-sales-template-2023-24.xlsx"), + }, + { + name: "Download the sales bulk upload template (2023 to 2024) – Legacy version", + href: download_23_24_sales_bulk_upload_legacy_template_path, + metadata: file_type_size_and_pages("bulk-upload-sales-legacy-template-2023-24.xlsx"), + }, + { + name: "Download the sales bulk upload specification (2023 to 2024)", + href: download_23_24_sales_bulk_upload_specification_path, + metadata: file_type_size_and_pages("bulk-upload-sales-specification-2023-24.xlsx"), + }, + ]) %> + <% end %> <% end %> -
+<% end %> diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index 9cfecda26..93b47fb03 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -41,8 +41,4 @@ <% end %> <%= render partial: "organisations/merged_organisation_details" %> - -
- <%= render partial: "layouts/collection_resources" %> -
diff --git a/app/views/start/index.html.erb b/app/views/start/index.html.erb index d6ec6d392..17e15d34e 100644 --- a/app/views/start/index.html.erb +++ b/app/views/start/index.html.erb @@ -16,14 +16,19 @@ href: start_path, ) %> +
+

Before you start

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

+ -

+
+
+
<%= render partial: "layouts/collection_resources" %>
diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 97665f8ca..68de93c51 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -310,42 +310,6 @@ RSpec.describe OrganisationsController, type: :request do it "redirects to details" do expect(response).to have_http_status(:redirect) end - - context "and 2022 collection window is open" do - let(:set_time) { allow(Time).to receive(:now).and_return(Time.zone.local(2023, 1, 1)) } - - it "displays correct resources for 2022/23 and 2023/24 collection years" do - follow_redirect! - expect(page).to have_content("Lettings 2023/24") - expect(page).to have_content("Sales 2023/24") - expect(page).to have_content("Lettings 2022/23") - expect(page).to have_content("Sales 2022/23") - end - end - - context "and 2022 collection window is closed for editing" do - let(:set_time) { allow(Time).to receive(:now).and_return(Time.zone.local(2024, 1, 1)) } - - it "displays correct resources for 2022/23 and 2023/24 collection years" do - follow_redirect! - expect(page).to have_content("Lettings 2023/24") - expect(page).to have_content("Sales 2023/24") - expect(page).not_to have_content("Lettings 2022/23") - expect(page).not_to have_content("Sales 2022/23") - end - end - - context "and 2023 collection window is closed for editing" do - let(:set_time) { allow(Time).to receive(:now).and_return(Time.zone.local(2025, 1, 1)) } - - it "displays correct resources for 2022/23 and 2023/24 collection years" do - follow_redirect! - expect(page).not_to have_content("Lettings 2023/24") - expect(page).not_to have_content("Sales 2023/24") - expect(page).not_to have_content("Lettings 2022/23") - expect(page).not_to have_content("Sales 2022/23") - end - end end context "with an organisation that are not in scope for the user, i.e. that they do not belong to" do diff --git a/spec/requests/start_controller_spec.rb b/spec/requests/start_controller_spec.rb index 1bfd2b4b9..2287280dc 100644 --- a/spec/requests/start_controller_spec.rb +++ b/spec/requests/start_controller_spec.rb @@ -31,6 +31,35 @@ RSpec.describe StartController, type: :request do get "/", headers:, params: {} expect(page).to have_content("Welcome back") end + + context "and 2023 collection window is open for editing" do + before do + allow(Time).to receive(:now).and_return(Time.zone.local(2024, 1, 1)) + end + + it "displays correct resources for 2022/23 and 2023/24 collection years" do + get "/", headers: headers, params: {} + expect(page).to have_content("Lettings 2023/24") + expect(page).to have_content("Sales 2023/24") + end + end + + context "and 2023 collection window is closed for editing" do + before do + allow(Time).to receive(:now).and_return(Time.zone.local(2025, 1, 1)) + end + + it "displays correct resources for 2022/23 and 2023/24 collection years" do + get "/", headers: headers, params: {} + expect(page).not_to have_content("Lettings 2023/24") + expect(page).not_to have_content("Sales 2023/24") + end + end + + it "shows guidance link" do + get "/", headers: headers, params: {} + expect(page).to have_content("Guidance for submitting social housing lettings and sales data (CORE)") + end end end