From 8187999708fa13c00bfd26a5734f49393383bdf0 Mon Sep 17 00:00:00 2001 From: JG Date: Wed, 27 Jul 2022 17:02:56 +0100 Subject: [PATCH] spike on hints --- app/views/users/new.html.erb | 20 +++++++++++++++----- spec/requests/users_controller_spec.rb | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index 64c815196..92e39c547 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -41,13 +41,23 @@ options: { disabled: [""], selected: @organisation_id ? answer_options.first : "" } %> <% end %> - <% roles = current_user.assignable_roles.map { |key, _| OpenStruct.new(id: key, name: key.to_s.humanize) } %> + + <% hints_for_roles = { data_provider: ["Can view and submit logs for this this organisation"], data_coordinator: ["Can view and submit logs for this this organisation"], support: [] } %> + + <% 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]) } %> <%= f.govuk_collection_radio_buttons :role, - roles, - :id, - :name, - legend: { text: "Role", size: "m" } %> + roles_with_hints, + :id, + :name, + ->(option) do + content_tag(:ul, class: "govuk-list govuk-list--bullet govuk-hint") do + content_tag(:li, "1") + content_tag(:li, "2") + content_tag(:li, "3") + end + end, + legend: { text: "Role", size: "m" } %> <%= f.govuk_collection_radio_buttons :is_dpo, [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")], diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index 2d1bb5dda..f7ba72e7c 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -1603,6 +1603,7 @@ RSpec.describe UsersController, type: :request do }, } end + before do FactoryBot.create(:user, email: "new_user@example.com") end