Browse Source

Move grabbing values out of view

pull/2971/head
Manny Dinssa 2 months ago
parent
commit
88c768b2ec
  1. 4
      app/helpers/organisations_helper.rb
  2. 10
      app/views/organisations/new.html.erb

4
app/helpers/organisations_helper.rb

@ -77,4 +77,8 @@ module OrganisationsHelper
"Enter #{text}" "Enter #{text}"
end end
def group_organisation_options
[OpenStruct.new(id: "", name: "")] + Organisation.visible.map { |org| OpenStruct.new(id: org.id, name: org.name) }
end
end end

10
app/views/organisations/new.html.erb

@ -56,8 +56,6 @@
:name, :name,
legend: { text: "Does the organisation hold its own stock?", size: "m" } %> legend: { text: "Does the organisation hold its own stock?", size: "m" } %>
<% group_organisation_options = [OpenStruct.new(id: "", name: "")] + Organisation.visible.map { |org| OpenStruct.new(id: org.id, name: org.name) } %>
<%= f.govuk_radio_buttons_fieldset :group_member, <%= f.govuk_radio_buttons_fieldset :group_member,
legend: { text: "Is this organisation part of a housing provider group structure?", size: "m" } do %> legend: { text: "Is this organisation part of a housing provider group structure?", size: "m" } do %>
<%= f.govuk_radio_button :group_member, true, <%= f.govuk_radio_button :group_member, true,
@ -76,14 +74,8 @@
<%= f.govuk_radio_button :group_member, false, label: { text: "No" } %> <%= f.govuk_radio_button :group_member, false, label: { text: "No" } %>
<% end %> <% end %>
<% profit_options = [
OpenStruct.new(id: 1, name: "Non-profit"),
OpenStruct.new(id: 2, name: "Profit"),
OpenStruct.new(id: 3, name: "Local authority")
] %>
<%= f.govuk_collection_select :profit_status, <%= f.govuk_collection_select :profit_status,
profit_options, Organisation::PROFIT_STATUS.map { |key, value| OpenStruct.new(id: value, name: key.to_s.humanize) },
:id, :id,
:name, :name,
label: { text: "Is the organisation for-profit?", size: "m" }, label: { text: "Is the organisation for-profit?", size: "m" },

Loading…
Cancel
Save