Browse Source

CLDC-3209 Publish 24_25 resources (#2155)

* feat: add 24/25 forms, shrink tab header font size and tidy up routes.rb

* feat: update formatting so 4 tabs don't wrap on small screen sizes, but links still wrap in list view

* feat: shrink headers, make text the same and match underline width to tabs component

* feat: use updated paper forms and fix typo in sales bu template

* refactor: lint

* feat: update tests

* feat: update copy

* feat: update copy

* feat: update copy

* feat: update tests and underline css

* feat: update tests and underline css

* refactor: lint

* feat: update paper forms

* feat: update file routes
pull/2163/head v0.4.8
natdeanlewissoftwire 11 months ago committed by GitHub
parent
commit
9487dc7c8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      app/components/document_list_component.html.erb
  2. 5
      app/components/document_list_component.rb
  3. 48
      app/controllers/start_controller.rb
  4. 15
      app/frontend/styles/_tab.scss
  5. 1
      app/frontend/styles/application.scss
  6. 2
      app/views/home/index.html.erb
  7. 69
      app/views/layouts/_collection_resources.html.erb
  8. 4
      app/views/start/index.html.erb
  9. 22
      config/routes.rb
  10. BIN
      public/files/2023_24_lettings_paper_form.pdf
  11. BIN
      public/files/2024_25_lettings_paper_form.pdf
  12. BIN
      public/files/2024_25_sales_paper_form.pdf
  13. BIN
      public/files/bulk-upload-lettings-specification-2024-25.xlsx
  14. BIN
      public/files/bulk-upload-lettings-template-2024-25.xlsx
  15. BIN
      public/files/bulk-upload-sales-legacy-template-2023-24.xlsx
  16. BIN
      public/files/bulk-upload-sales-specification-2024-25.xlsx
  17. BIN
      public/files/bulk-upload-sales-template-2024-25.xlsx
  18. 3
      spec/components/document_list_component_spec.rb
  19. 2
      spec/helpers/collection_resources_helper_spec.rb
  20. 24
      spec/requests/start_controller_spec.rb

1
app/components/document_list_component.html.erb

@ -1,3 +1,4 @@
<h3 class="govuk-heading-m"><%= label %></h3>
<dl class="app-document-list">
<% items.each do |item| %>
<div class="app-document-list__item">

5
app/components/document_list_component.rb

@ -1,8 +1,9 @@
class DocumentListComponent < ViewComponent::Base
attr_reader :items
attr_reader :items, :label
def initialize(items:)
def initialize(items:, label:)
@items = items
@label = label
super
end
end

48
app/controllers/start_controller.rb

@ -5,6 +5,14 @@ class StartController < ApplicationController
end
end
def download_24_25_sales_form
send_file(
Rails.root.join("public/files/2024_25_sales_paper_form.pdf"),
filename: "2024-25 Sales paper form.pdf",
type: "application/pdf",
)
end
def download_23_24_sales_form
send_file(
Rails.root.join("public/files/2023_24_sales_paper_form.pdf"),
@ -21,6 +29,14 @@ class StartController < ApplicationController
)
end
def download_24_25_lettings_form
send_file(
Rails.root.join("public/files/2024_25_lettings_paper_form.pdf"),
filename: "2024-25 Lettings paper form.pdf",
type: "application/pdf",
)
end
def download_23_24_lettings_form
send_file(
Rails.root.join("public/files/2023_24_lettings_paper_form.pdf"),
@ -37,6 +53,38 @@ class StartController < ApplicationController
)
end
def download_24_25_lettings_bulk_upload_template
send_file(
Rails.root.join("public/files/bulk-upload-lettings-template-2024-25.xlsx"),
filename: "2024-25-lettings-bulk-upload-template.xlsx",
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
end
def download_24_25_lettings_bulk_upload_specification
send_file(
Rails.root.join("public/files/bulk-upload-lettings-specification-2024-25.xlsx"),
filename: "2024-25-lettings-bulk-upload-specification.xlsx",
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
end
def download_24_25_sales_bulk_upload_template
send_file(
Rails.root.join("public/files/bulk-upload-sales-template-2024-25.xlsx"),
filename: "2024-25-sales-bulk-upload-template.xlsx",
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
end
def download_24_25_sales_bulk_upload_specification
send_file(
Rails.root.join("public/files/bulk-upload-sales-specification-2024-25.xlsx"),
filename: "2024-25-sales-bulk-upload-specification.xlsx",
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
end
def download_23_24_lettings_bulk_upload_template
send_file(
Rails.root.join("public/files/bulk-upload-lettings-template-2023-24.xlsx"),

15
app/frontend/styles/_tab.scss

@ -0,0 +1,15 @@
.app-tab__small-headers {
@include govuk-font(16);
}
@media (min-width: 35.375em) {
.app-tab__list-view {
min-width: 35.375em;
}
}
@media (min-width: 35.375em) {
.app-tab__underline {
min-width: 35.375em;
}
}

1
app/frontend/styles/application.scss

@ -38,6 +38,7 @@ $govuk-breakpoints: (
@import "metadata";
@import "related-navigation";
@import "section-skip-link";
@import "tab";
@import "table-group";
@import "tag";
@import "task-list";

2
app/views/home/index.html.erb

@ -48,7 +48,7 @@
</div>
<div class="govuk-grid-row">
<%= render partial: "layouts/collection_resources" %>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8">
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8 app-tab__underline">
<%= render partial: "home/upcoming_deadlines" %>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8">
<%= render partial: "layouts/about_this_service" %>

69
app/views/layouts/_collection_resources.html.erb

@ -4,11 +4,60 @@
<% else %>
<h2 class="govuk-heading-m">Collection resources</h2>
<% end %>
<p class="govuk-body">Use the 2024 to 2025 forms for lettings that start and sales that complete between 1 April 2024 and 31 March 2025.</p>
<p class="govuk-body">Use the 2023 to 2024 forms for lettings that start and sales that complete between 1 April 2023 and 31 March 2024.</p>
<%= govuk_tabs(title: "Collection resources") do |c| %>
<div class="app-tab__list-view">
<%= govuk_tabs(title: "Collection resources", classes: %w[app-tab__small-headers]) do |c| %>
<% if FormHandler.instance.lettings_form_for_start_year(2024) && FormHandler.instance.lettings_form_for_start_year(2024).edit_end_date > Time.zone.today %>
<% c.with_tab(label: "Lettings 24/25") do %>
<%= render DocumentListComponent.new(
items: [
{
name: "Download the lettings log for tenants (2024 to 2025)",
href: download_24_25_lettings_form_path,
metadata: file_type_size_and_pages("2024_25_lettings_paper_form.pdf", number_of_pages: 8),
},
{
name: "Download the lettings bulk upload template (2024 to 2025)",
href: download_24_25_lettings_bulk_upload_template_path,
metadata: file_type_size_and_pages("bulk-upload-lettings-template-2024-25.xlsx"),
},
{
name: "Download the lettings bulk upload specification (2024 to 2025)",
href: download_24_25_lettings_bulk_upload_specification_path,
metadata: file_type_size_and_pages("bulk-upload-lettings-specification-2024-25.xlsx"),
},
],
label: "Lettings 2024 to 2025",
) %>
<% end %>
<% c.with_tab(label: "Sales 24/25") do %>
<%= render DocumentListComponent.new(
items: [
{
name: "Download the sales log for buyers (2024 to 2025)",
href: download_24_25_sales_form_path,
metadata: file_type_size_and_pages("2024_25_sales_paper_form.pdf", number_of_pages: 8),
},
{
name: "Download the sales bulk upload template (2024 to 2025)",
href: download_24_25_sales_bulk_upload_template_path,
metadata: file_type_size_and_pages("bulk-upload-sales-template-2024-25.xlsx"),
},
{
name: "Download the sales bulk upload specification (2024 to 2025)",
href: download_24_25_sales_bulk_upload_specification_path,
metadata: file_type_size_and_pages("bulk-upload-sales-specification-2024-25.xlsx"),
},
],
label: "Sales 2024 to 2025",
) %>
<% end %>
<% end %>
<% if FormHandler.instance.lettings_form_for_start_year(2023) && FormHandler.instance.lettings_form_for_start_year(2023).edit_end_date > Time.zone.today %>
<% c.with_tab(label: "Lettings 2023/24") do %>
<%= render DocumentListComponent.new(items: [
<% c.with_tab(label: "Lettings 23/24") do %>
<%= render DocumentListComponent.new(
items: [
{
name: "Download the lettings log for tenants (2023 to 2024)",
href: download_23_24_lettings_form_path,
@ -29,10 +78,13 @@
href: download_23_24_lettings_bulk_upload_specification_path,
metadata: file_type_size_and_pages("bulk-upload-lettings-specification-2023-24.xlsx"),
},
]) %>
],
label: "Lettings 2023 to 2024",
) %>
<% end %>
<% c.with_tab(label: "Sales 2023/24") do %>
<%= render DocumentListComponent.new(items: [
<% c.with_tab(label: "Sales 23/24") do %>
<%= render DocumentListComponent.new(
items: [
{
name: "Download the sales log for buyers (2023 to 2024)",
href: download_23_24_sales_form_path,
@ -53,7 +105,10 @@
href: download_23_24_sales_bulk_upload_specification_path,
metadata: file_type_size_and_pages("bulk-upload-sales-specification-2023-24.xlsx"),
},
]) %>
],
label: "Sales 2023 to 2024",
) %>
<% end %>
<% end %>
<% end %>
</div>

4
app/views/start/index.html.erb

@ -22,10 +22,10 @@
<p class="govuk-body">Use your account details to sign in.</p>
<p class="govuk-body">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) %>.</p>
<p class="govuk-body">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.</p>
<p class="govuk-body"><strong><%= govuk_link_to guidance_path do %>Guidance for submitting social housing lettings and sales data (CORE)<% end %></strong><p>
<p class="govuk-body"><strong><%= govuk_link_to guidance_path do %>Guidance for submitting social housing lettings and sales data (CORE)<% end %></strong></p>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8">
<%= render partial: "layouts/collection_resources" %>
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8">
<hr class="govuk-section-break govuk-section-break--visible govuk-section-break--m govuk-!-margin-top-8 govuk-!-margin-bottom-8 app-tab__underline">
<%= render partial: "layouts/about_this_service" %>
</div>
</div>

22
config/routes.rb

@ -39,23 +39,31 @@ Rails.application.routes.draw do
get "/service-moved", to: "maintenance#service_moved"
get "/service-unavailable", to: "maintenance#service_unavailable"
get "/download-23-24-lettings-form", to: "start#download_23_24_lettings_form"
get "/download-22-23-lettings-form", to: "start#download_22_23_lettings_form"
get "/download-22-23-lettings-bulk-upload-template", to: "start#download_22_23_lettings_bulk_upload_template"
get "/download-22-23-lettings-bulk-upload-specification", to: "start#download_22_23_lettings_bulk_upload_specification"
get "/download-22-23-sales-form", to: "start#download_22_23_sales_form"
get "/download-22-23-sales-bulk-upload-template", to: "start#download_22_23_sales_bulk_upload_template"
get "/download-22-23-sales-bulk-upload-specification", to: "start#download_22_23_sales_bulk_upload_specification"
get "/download-23-24-lettings-form", to: "start#download_23_24_lettings_form"
get "/download-23-24-lettings-bulk-upload-template", to: "start#download_23_24_lettings_bulk_upload_template"
get "/download-23-24-lettings-bulk-upload-legacy-template", to: "start#download_23_24_lettings_bulk_upload_legacy_template"
get "/download-23-24-lettings-bulk-upload-specification", to: "start#download_23_24_lettings_bulk_upload_specification"
get "/download-22-23-lettings-bulk-upload-template", to: "start#download_22_23_lettings_bulk_upload_template"
get "/download-22-23-lettings-bulk-upload-specification", to: "start#download_22_23_lettings_bulk_upload_specification"
get "/download-23-24-sales-form", to: "start#download_23_24_sales_form"
get "/download-22-23-sales-form", to: "start#download_22_23_sales_form"
get "/download-23-24-sales-bulk-upload-template", to: "start#download_23_24_sales_bulk_upload_template"
get "/download-23-24-sales-bulk-upload-legacy-template", to: "start#download_23_24_sales_bulk_upload_legacy_template"
get "/download-23-24-sales-bulk-upload-specification", to: "start#download_23_24_sales_bulk_upload_specification"
get "/download-22-23-sales-bulk-upload-template", to: "start#download_22_23_sales_bulk_upload_template"
get "/download-22-23-sales-bulk-upload-specification", to: "start#download_22_23_sales_bulk_upload_specification"
get "/download-24-25-lettings-form", to: "start#download_24_25_lettings_form"
get "/download-24-25-lettings-bulk-upload-template", to: "start#download_24_25_lettings_bulk_upload_template"
get "/download-24-25-lettings-bulk-upload-specification", to: "start#download_24_25_lettings_bulk_upload_specification"
get "/download-24-25-sales-form", to: "start#download_24_25_sales_form"
get "/download-24-25-sales-bulk-upload-template", to: "start#download_24_25_sales_bulk_upload_template"
get "/download-24-25-sales-bulk-upload-specification", to: "start#download_24_25_sales_bulk_upload_specification"
get "clear-filters", to: "sessions#clear_filters"

BIN
public/files/2023_24_lettings_paper_form.pdf

Binary file not shown.

BIN
public/files/2024_25_lettings_paper_form.pdf

Binary file not shown.

BIN
public/files/2024_25_sales_paper_form.pdf

Binary file not shown.

BIN
public/files/bulk-upload-lettings-specification-2024-25.xlsx

Binary file not shown.

BIN
public/files/bulk-upload-lettings-template-2024-25.xlsx

Binary file not shown.

BIN
public/files/bulk-upload-sales-legacy-template-2023-24.xlsx

Binary file not shown.

BIN
public/files/bulk-upload-sales-specification-2024-25.xlsx

Binary file not shown.

BIN
public/files/bulk-upload-sales-template-2024-25.xlsx

Binary file not shown.

3
spec/components/document_list_component_spec.rb

@ -8,8 +8,9 @@ RSpec.describe DocumentListComponent, type: :component do
context "when rendering tabs" do
it "all of the nav tabs specified in the items hash are passed to it" do
result = render_inline(described_class.new(items:))
result = render_inline(described_class.new(items:, label: "Label"))
expect(result.text).to include("Label")
expect(result.text).to include("PDF Form")
expect(result.text).to include("An important form")
expect(result.text).to include("4 pages")

2
spec/helpers/collection_resources_helper_spec.rb

@ -7,7 +7,7 @@ RSpec.describe CollectionResourcesHelper do
describe "when displaying file metadata" do
context "with pages" do
it "returns correct metadata" do
expect(file_type_size_and_pages("2023_24_lettings_paper_form.pdf", number_of_pages: 8)).to eq("PDF, 285 KB, 8 pages")
expect(file_type_size_and_pages("2023_24_lettings_paper_form.pdf", number_of_pages: 8)).to eq("PDF, 286 KB, 8 pages")
end
end

24
spec/requests/start_controller_spec.rb

@ -37,10 +37,16 @@ RSpec.describe StartController, type: :request 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
it "displays correct resources for 2023/24 and 2024/25 collection years" do
get "/", headers: headers, params: {}
expect(page).to have_content("Lettings 2023/24")
expect(page).to have_content("Sales 2023/24")
expect(page).to have_content("Lettings 24/25")
expect(page).to have_content("Lettings 23/24")
expect(page).to have_content("Lettings 2024 to 2025")
expect(page).to have_content("Lettings 2023 to 2024")
expect(page).to have_content("Sales 24/25")
expect(page).to have_content("Sales 23/24")
expect(page).to have_content("Sales 2024 to 2025")
expect(page).to have_content("Sales 2023 to 2024")
end
end
@ -49,10 +55,16 @@ RSpec.describe StartController, type: :request 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
it "displays correct resources for 2023/24 and 2024/25 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")
expect(page).to have_content("Lettings 24/25")
expect(page).not_to have_content("Lettings 23/24")
expect(page).to have_content("Lettings 2024 to 2025")
expect(page).not_to have_content("Lettings 2023 to 2024")
expect(page).to have_content("Sales 24/25")
expect(page).not_to have_content("Sales 23/24")
expect(page).to have_content("Sales 2024 to 2025")
expect(page).not_to have_content("Sales 2023 to 2024")
end
end

Loading…
Cancel
Save