Browse Source

fixe3d

pull/716/head
JG 3 years ago
parent
commit
711e93823e
  1. 2
      app/controllers/schemes_controller.rb
  2. 6
      app/views/schemes/details.html.erb
  3. 3
      config/locales/en.yml

2
app/controllers/schemes_controller.rb

@ -30,7 +30,7 @@ class SchemesController < ApplicationController
render "schemes/primary_client_group" render "schemes/primary_client_group"
else else
@scheme.errors.add(:owning_organisation_id, message: @scheme.errors[:organisation]) @scheme.errors.add(:owning_organisation_id, message: @scheme.errors[:organisation])
@scheme.errors.delete(:organisation) @scheme.errors.delete(:owning_organisation)
render :new, status: :unprocessable_entity render :new, status: :unprocessable_entity
end end
end end

6
app/views/schemes/details.html.erb

@ -27,10 +27,10 @@
<% null_option = [OpenStruct.new(id: "", name: "Select an option")] %> <% null_option = [OpenStruct.new(id: "", name: "Select an option")] %>
<% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %> <% organisations = Organisation.all.map { |org| OpenStruct.new(id: org.id, name: org.name) } %>
<% stock_org_answer_options = null_option + organisations %> <% managing_org_answer_options = null_option + organisations %>
<%= f.govuk_collection_select :managing_organisation_id, <%= f.govuk_collection_select :managing_organisation_id,
organisations, managing_org_answer_options,
:id, :id,
:name, :name,
label: { text: "Which organisation manages this scheme?", size: "m" }, label: { text: "Which organisation manages this scheme?", size: "m" },
@ -39,7 +39,7 @@
<% if current_user.support? %> <% if current_user.support? %>
<%= f.govuk_collection_select :owning_organisation_id, <%= f.govuk_collection_select :owning_organisation_id,
stock_org_answer_options, organisations,
:id, :id,
:name, :name,
label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" }, label: { text: "Which organisation owns the housing stock for this scheme?", size: "m" },

3
config/locales/en.yml

@ -43,8 +43,9 @@ en:
models: models:
scheme: scheme:
attributes: attributes:
owning_organisation: owninggit st _organisation_id:
required: "Enter the existing organisation’s name" required: "Enter the existing organisation’s name"
invalid: "Enter the existing organisation’s name"
validations: validations:
organisation: organisation:

Loading…
Cancel
Save