Browse Source

feat: update files, add 22/23 lettings form to local storage and add collection resources helper

pull/1671/head
natdeanlewissoftwire 3 years ago
parent
commit
625e86cbcb
  1. 8
      app/controllers/start_controller.rb
  2. 13
      app/helpers/collection_resources_helper.rb
  3. 30
      app/views/layouts/_collection_resources.html.erb
  4. 1
      config/routes.rb
  5. BIN
      public/files/2022_23_lettings_paper_form.pdf
  6. BIN
      public/files/bulk-upload-sales-legacy-template-2023-24.xlsx
  7. BIN
      public/files/bulk-upload-sales-template-2023-24.xlsx

8
app/controllers/start_controller.rb

@ -29,6 +29,14 @@ class StartController < ApplicationController
) )
end end
def download_22_23_lettings_form
send_file(
Rails.root.join("public/files/2022_23_lettings_paper_form.pdf"),
filename: "2022-23 Lettings paper form.pdf",
type: "application/pdf",
)
end
def download_23_24_lettings_bulk_upload_template def download_23_24_lettings_bulk_upload_template
send_file( send_file(
Rails.root.join("public/files/bulk-upload-lettings-template-2023-24.xlsx"), Rails.root.join("public/files/bulk-upload-lettings-template-2023-24.xlsx"),

13
app/helpers/collection_resources_helper.rb

@ -0,0 +1,13 @@
module CollectionResourcesHelper
def metadata_helper(file, pages = nil)
extension = file.split(".")[-1]
type_string = case extension
when "xlsx" then "Microsoft Excel"
when "pdf" then "PDF"
else extension
end
size = number_to_human_size(File.size("public/files/#{file}"), precision: 0, significant: false)
pages_string = pages.present? ? pluralize(pages, "page") : nil
[type_string, size, pages_string].compact.join(", ")
end
end

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

@ -7,22 +7,22 @@
{ {
name: "Lettings log for tenants (2023/24)", name: "Lettings log for tenants (2023/24)",
href: download_23_24_lettings_form_path, href: download_23_24_lettings_form_path,
metadata: "PDF, 278 KB, 8 pages", metadata: metadata_helper("2023_24_lettings_paper_form.pdf", 8)
}, },
{ {
name: "Lettings bulk upload template (2023/24) – New question ordering", name: "Lettings bulk upload template (2023/24) – New question ordering",
href: download_23_24_lettings_bulk_upload_template_path, href: download_23_24_lettings_bulk_upload_template_path,
metadata: "Microsoft Excel, 15 KB", metadata: metadata_helper("bulk-upload-lettings-template-2023-24.xlsx"),
}, },
{ {
name: "Lettings bulk upload template (2023/24)", name: "Lettings bulk upload template (2023/24)",
href: download_23_24_lettings_bulk_upload_legacy_template_path, href: download_23_24_lettings_bulk_upload_legacy_template_path,
metadata: "Microsoft Excel, 15 KB", metadata: metadata_helper("bulk-upload-lettings-legacy-template-2023-24.xlsx"),
}, },
{ {
name: "Lettings bulk upload specification (2023/24)", name: "Lettings bulk upload specification (2023/24)",
href: download_23_24_lettings_bulk_upload_specification_path, href: download_23_24_lettings_bulk_upload_specification_path,
metadata: "Microsoft Excel, 90 KB", metadata: metadata_helper("bulk-upload-lettings-specification-2023-24.xlsx"),
}, },
]) %> ]) %>
@ -31,22 +31,22 @@
{ {
name: "Sales log for buyers (2023/24)", name: "Sales log for buyers (2023/24)",
href: download_23_24_sales_form_path, href: download_23_24_sales_form_path,
metadata: "PDF, 421 KB, 8 pages", metadata: metadata_helper("2023_24_sales_paper_form.pdf", 8),
}, },
{ {
name: "Sales bulk upload template (2023/24) – New question ordering", name: "Sales bulk upload template (2023/24) – New question ordering",
href: download_23_24_sales_bulk_upload_template_path, href: download_23_24_sales_bulk_upload_template_path,
metadata: "Microsoft Excel, 21 KB", metadata: metadata_helper("bulk-upload-sales-template-2023-24.xlsx"),
}, },
{ {
name: "Sales bulk upload template (2023/24)", name: "Sales bulk upload template (2023/24)",
href: download_23_24_sales_bulk_upload_legacy_template_path, href: download_23_24_sales_bulk_upload_legacy_template_path,
metadata: "Microsoft Excel, 21 KB", metadata: metadata_helper("bulk-upload-sales-legacy-template-2023-24.xlsx"),
}, },
{ {
name: "Sales bulk upload specification (2023/24)", name: "Sales bulk upload specification (2023/24)",
href: download_23_24_sales_bulk_upload_specification_path, href: download_23_24_sales_bulk_upload_specification_path,
metadata: "Microsoft Excel, 38 KB", metadata: metadata_helper("bulk-upload-sales-specification-2023-24.xlsx"),
}, },
]) %> ]) %>
@ -54,18 +54,18 @@
<%= render DocumentListComponent.new(items: [ <%= render DocumentListComponent.new(items: [
{ {
name: "Lettings log for tenants (2022/23)", name: "Lettings log for tenants (2022/23)",
href: "https://core.communities.gov.uk/public/download/guides-and-manuals/2022-23%20Lettings%20paper%20form.pdf?download-format=pdf", href: download_22_23_lettings_form_path,
metadata: "PDF, 654 KB, 4 pages", metadata: metadata_helper("2022_23_lettings_paper_form.pdf", 4),
}, },
{ {
name: "Lettings bulk upload template (2022/23)", name: "Lettings bulk upload template (2022/23)",
href: download_22_23_lettings_bulk_upload_template_path, href: download_22_23_lettings_bulk_upload_template_path,
metadata: "Microsoft Excel, 36 KB", metadata: metadata_helper("bulk-upload-lettings-template-2022-23.xlsx"),
}, },
{ {
name: "Lettings bulk upload specification (2022/23)", name: "Lettings bulk upload specification (2022/23)",
href: download_22_23_lettings_bulk_upload_specification_path, href: download_22_23_lettings_bulk_upload_specification_path,
metadata: "Microsoft Excel, 53 KB", metadata: metadata_helper("bulk-upload-lettings-specification-2022-23.xlsx"),
}, },
]) %> ]) %>
@ -74,17 +74,17 @@
{ {
name: "Sales log for buyers (2022/23)", name: "Sales log for buyers (2022/23)",
href: download_22_23_sales_form_path, href: download_22_23_sales_form_path,
metadata: "PDF, 397 KB, 5 pages", metadata: metadata_helper("2022_23_sales_paper_form.pdf", 5),
}, },
{ {
name: "Sales bulk upload template (2022/23)", name: "Sales bulk upload template (2022/23)",
href: download_22_23_sales_bulk_upload_template_path, href: download_22_23_sales_bulk_upload_template_path,
metadata: "Microsoft Excel, 14 KB", metadata: metadata_helper("bulk-upload-sales-template-2022-23.xlsx"),
}, },
{ {
name: "Sales bulk upload specification (2022/23)", name: "Sales bulk upload specification (2022/23)",
href: download_22_23_sales_bulk_upload_specification_path, href: download_22_23_sales_bulk_upload_specification_path,
metadata: "Microsoft Excel, 24 KB", metadata: metadata_helper("bulk-upload-sales-template-2022-23.xlsx"),
}, },
]) %> ]) %>
</div> </div>

1
config/routes.rb

@ -37,6 +37,7 @@ Rails.application.routes.draw do
get "/data-sharing-agreement", to: "content#data_sharing_agreement" get "/data-sharing-agreement", to: "content#data_sharing_agreement"
get "/download-23-24-lettings-form", to: "start#download_23_24_lettings_form" 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-23-24-lettings-bulk-upload-template", to: "start#download_23_24_lettings_bulk_upload_template" 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-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-23-24-lettings-bulk-upload-specification", to: "start#download_23_24_lettings_bulk_upload_specification"

BIN
public/files/2022_23_lettings_paper_form.pdf

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-template-2023-24.xlsx

Binary file not shown.
Loading…
Cancel
Save