Browse Source

refactored

pull/787/head
JG 3 years ago
parent
commit
440ee8cba5
  1. 1
      app/controllers/users_controller.rb
  2. 17
      app/views/users/new.html.erb

1
app/controllers/users_controller.rb

@ -65,7 +65,6 @@ class UsersController < ApplicationController
def new def new
@organisation_id = params["organisation_id"] @organisation_id = params["organisation_id"]
@resource = User.new @resource = User.new
debugger
end end
def create def create

17
app/views/users/new.html.erb

@ -42,7 +42,7 @@
<% end %> <% end %>
<% hints_for_roles = { data_provider: ["Provider hint"], data_coordinator: ["Support hint", "Other"], support: [] } %> <% hints_for_roles = { data_provider: ["Default role for this organisation", "Can view and submit logs for this organisation"], data_coordinator: ["Can view and submit logs for this organisation and any of its managing agents", "Can manage details for this organisation", "Can manage users for this organisation"], support: nil } %>
<% roles_with_hints = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints_for_roles[key.to_sym]) } %> <% roles_with_hints = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize, description: hints_for_roles[key.to_sym]) } %>
@ -51,23 +51,10 @@
:id, :id,
:name, :name,
->(option) do ->(option) do
result = option.description.sum(nil) {|hint| content_tag(:li, hint) } result = option.description&.sum(nil) {|hint| content_tag(:li, hint) }
end, end,
legend: { text: "Role", size: "m" } %> legend: { text: "Role", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_dpo,
[OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id,
:name,
legend: { text: "#{perspective(@user, current_user)} the organisation’s data protection officer?", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_key_contact,
[OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id,
:name,
legend: { text: "#{perspective(@user, current_user)} a key contact for this service?", size: "m" },
hint: { text: "This is a person responsible for sharing information about social housing lettings and sales data within the organisation." } %>
<%= f.govuk_submit "Continue" %> <%= f.govuk_submit "Continue" %>
</div> </div>
</div> </div>

Loading…
Cancel
Save