Browse Source

Radio value labels before type cast

CLDC-1348-basic-validation-for-scheme-and-location-refactor
baarkerlounger 2 years ago
parent
commit
52bc6f7519
  1. 16
      app/views/schemes/details.html.erb

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

@ -64,18 +64,18 @@
<% end %> <% end %>
<% support_services_provider_selection = Scheme.support_services_providers.map do |key, value| %> <% support_services_provider_selection = Scheme.support_services_providers.map do |key, value| %>
<% if value.zero? %>
<% selection_value = current_user.support? ? "The same organisation that owns the housing stock" : "Your organisation" %>
<% OpenStruct.new(id: value, name: selection_value) %>
<% else %>
<% OpenStruct.new(id: value, name: key.to_s.humanize) %> <% OpenStruct.new(id: value, name: key.to_s.humanize) %>
<% end %>
<% end %> <% end %>
<%= f.govuk_collection_radio_buttons :support_services_provider_before_type_cast,
<%= f.govuk_collection_radio_buttons :support_services_provider,
support_services_provider_selection, support_services_provider_selection,
:id, :id,
:name, ->(option) do
if option.id.zero? && !current_user.support?
"Your organisation"
else
option.name
end
end,
legend: { text: "Who provides the support services used by this scheme?", size: "m" } %> legend: { text: "Who provides the support services used by this scheme?", size: "m" } %>
<%= f.hidden_field :page, value: "details" %> <%= f.hidden_field :page, value: "details" %>

Loading…
Cancel
Save