Browse Source
* CLDC-2128: Validate supplied year in bulk upload pages * Fix lint * Refactorpull/2818/head v0.4.88
Rachael Booth
3 weeks ago
committed by
GitHub
6 changed files with 257 additions and 69 deletions
@ -1,39 +0,0 @@ |
|||||||
module Forms |
|
||||||
module BulkUploadLettings |
|
||||||
class Needstype |
|
||||||
include ActiveModel::Model |
|
||||||
include ActiveModel::Attributes |
|
||||||
include Rails.application.routes.url_helpers |
|
||||||
|
|
||||||
attribute :needstype, :integer |
|
||||||
attribute :year, :integer |
|
||||||
attribute :organisation_id, :integer |
|
||||||
|
|
||||||
validates :needstype, presence: true |
|
||||||
|
|
||||||
def view_path |
|
||||||
"bulk_upload_lettings_logs/forms/needstype" |
|
||||||
end |
|
||||||
|
|
||||||
def options |
|
||||||
[OpenStruct.new(id: 1, name: "General needs"), OpenStruct.new(id: 2, name: "Supported housing")] |
|
||||||
end |
|
||||||
|
|
||||||
def back_path |
|
||||||
bulk_upload_lettings_log_path(id: "prepare-your-file", form: { year:, needstype:, organisation_id: }.compact) |
|
||||||
end |
|
||||||
|
|
||||||
def next_path |
|
||||||
bulk_upload_lettings_log_path(id: "upload-your-file", form: { year:, needstype:, organisation_id: }.compact) |
|
||||||
end |
|
||||||
|
|
||||||
def year_combo |
|
||||||
"#{year} to #{year + 1}" |
|
||||||
end |
|
||||||
|
|
||||||
def save! |
|
||||||
true |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
||||||
end |
|
@ -1,23 +0,0 @@ |
|||||||
<% content_for :before_content do %> |
|
||||||
<%= govuk_back_link href: @form.back_path %> |
|
||||||
<% end %> |
|
||||||
|
|
||||||
<div class="govuk-grid-row"> |
|
||||||
<div class="govuk-grid-column-two-thirds-from-desktop"> |
|
||||||
<%= form_with model: @form, scope: :form, url: bulk_upload_lettings_log_path(id: "needstype"), method: :patch do |f| %> |
|
||||||
<%= f.govuk_error_summary %> |
|
||||||
<%= f.hidden_field :year %> |
|
||||||
<%= f.hidden_field :organisation_id %> |
|
||||||
|
|
||||||
<%= f.govuk_collection_radio_buttons :needstype, |
|
||||||
@form.options, |
|
||||||
:id, |
|
||||||
:name, |
|
||||||
hint: { text: I18n.t("hints.bulk_upload.needstype") }, |
|
||||||
legend: { text: "What is the needs type?", size: "l" }, |
|
||||||
caption: { text: "Upload lettings logs in bulk (#{@form.year_combo})", size: "l" } %> |
|
||||||
|
|
||||||
<%= f.govuk_submit %> |
|
||||||
<% end %> |
|
||||||
</div> |
|
||||||
</div> |
|
Loading…
Reference in new issue