Browse Source
* feat: add la manual edit page * feat: make autocomplete accesible and la readable * feat: add correct skip and linking behaviour, also rename fallback page * feat: add page not found and tidy la list * feat: add redirection behaviour * feat: add coping with nil add_another_location query string * test: add postcodes mocks to return local authorities * feat: validate local authority to not be nil or "Select an option" * feat: persist add_another_location even on validation failure * feat: remove url query parsing, put validation before values added to db * refactor: spacing * tests: add new tests for edit-local-authority * tests: remove redundant bangsCLDC-1469-local-authority-question-sales
natdeanlewissoftwire
2 years ago
committed by
GitHub
12 changed files with 222 additions and 13 deletions
@ -0,0 +1,35 @@
|
||||
<% content_for :before_content do %> |
||||
<%= govuk_back_link( |
||||
text: "Back", |
||||
href: "/schemes/#{@scheme.id}/locations", |
||||
) %> |
||||
<% end %> |
||||
|
||||
<%= form_for(@location, method: :patch, url: location_path(location_id: @location.id, add_another_location: params[:add_another_location])) do |f| %> |
||||
<div class="govuk-grid-row"> |
||||
<div class="govuk-grid-column-two-thirds"> |
||||
<%= f.govuk_error_summary %> |
||||
|
||||
<%= render partial: "organisations/headings", locals: { main: "What is the local authority of #{@location.postcode}?", sub: @scheme.service_name } %> |
||||
|
||||
<% la_list = FormHandler.instance.current_lettings_form.get_question("la", nil).answer_options.values %> |
||||
|
||||
<% las = la_list.map { |la| OpenStruct.new(name: la) } %> |
||||
|
||||
<%= f.govuk_collection_select :location_admin_district, |
||||
las, |
||||
:name, |
||||
:name, |
||||
label: { hidden: true }, |
||||
"data-controller": %w[conditional-filter accessible-autocomplete] %> |
||||
|
||||
<%= f.hidden_field :page, value: "edit-local-authority" %> |
||||
|
||||
<div class="govuk-button-group"> |
||||
<%= f.govuk_submit "Save and continue" %> |
||||
|
||||
<%= govuk_link_to "Skip for now", "/schemes/#{@scheme.id}/check-answers#locations" %> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<% end %> |
Loading…
Reference in new issue