Browse Source

Merge pull request #583 from communitiesuk/user-management-tweaks

User management tweaks
pull/585/head
Paul Robert Lloyd 3 years ago committed by GitHub
parent
commit
94ad5243f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/frontend/styles/_tag.scss
  2. 1
      app/frontend/styles/application.scss
  3. 16
      app/views/users/edit.html.erb
  4. 17
      app/views/users/index.html.erb
  5. 15
      app/views/users/new.html.erb

7
app/frontend/styles/_tag.scss

@ -0,0 +1,7 @@
.app-tag--small {
@include govuk-font(14, $weight: bold);
padding-top: 2px;
padding-right: 6px;
padding-bottom: 2px;
padding-left: 6px;
}

1
app/frontend/styles/application.scss

@ -33,6 +33,7 @@ $govuk-breakpoints: (
@import "related-navigation"; @import "related-navigation";
@import "section-skip-link"; @import "section-skip-link";
@import "table-group"; @import "table-group";
@import "tag";
@import "task-list"; @import "task-list";
@import "template"; @import "template";
@import "pagination"; @import "pagination";

16
app/views/users/edit.html.erb

@ -1,4 +1,4 @@
<% content_for :title, current_user == @user ? "Change your personal details" : "Change #{@user.name}’s personal details" %> <% content_for :title, current_user == @user ? "Change your personal details" : "Change #{@user.name.presence || 'this user'}’s personal details" %>
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
@ -17,10 +17,11 @@
</h1> </h1>
<%= f.govuk_text_field :name, <%= f.govuk_text_field :name,
label: { text: "Name", size: "m" },
autocomplete: "name" %> autocomplete: "name" %>
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address", size: "m" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false" %> spellcheck: "false" %>
@ -34,18 +35,17 @@
legend: { text: "Role", size: "m" } %> legend: { text: "Role", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_dpo, <%= f.govuk_collection_radio_buttons :is_dpo,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id, :id,
:name, :name,
inline: true, legend: { text: "Are #{pronoun(@user, current_user)} the organisation’s data protection officer?", size: "m" } %>
legend: { text: "Are #{pronoun(@user, current_user)} a data protection officer?", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_key_contact, <%= f.govuk_collection_radio_buttons :is_key_contact,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id, :id,
:name, :name,
inline: true, legend: { text: "Are #{pronoun(@user, current_user)} a key contact for this service?", size: "m" },
legend: { text: "Are #{pronoun(@user, current_user)} a key contact?", size: "m" } %> hint: { text: "This is a person responsible for sharing information about social housing lettings and sales data within the organisation." } %>
<% end %> <% end %>
<%= f.govuk_submit "Save changes" %> <%= f.govuk_submit "Save changes" %>

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

@ -23,7 +23,22 @@
<% @users.each do |user| %> <% @users.each do |user| %>
<%= table.body do |body| %> <%= table.body do |body| %>
<%= body.row do |row| %> <%= body.row do |row| %>
<% row.cell(text: simple_format(user_cell(user), {}, wrapper_tag: "div")) %> <% row.cell do %>
<%= simple_format(user_cell(user), {}, wrapper_tag: "span") %>
<% if user.is_data_protection_officer? || user.is_key_contact? %>
<br>
<% end %>
<%= user.is_data_protection_officer? ? govuk_tag(
classes: "app-tag--small",
colour: "turquoise",
text: "Data protection officer",
) : "" %>
<%= user.is_key_contact? ? govuk_tag(
classes: "app-tag--small",
colour: "turquoise",
text: "Key contact",
) : "" %>
<% end %>
<% row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) %> <% row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div")) %>
<% row.cell(text: user.last_sign_in_at&.to_formatted_s(:govuk_date)) %> <% row.cell(text: user.last_sign_in_at&.to_formatted_s(:govuk_date)) %>
<% end %> <% end %>

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

@ -18,10 +18,10 @@
<%= f.govuk_text_field :name, <%= f.govuk_text_field :name,
autocomplete: "name", autocomplete: "name",
label: { text: "Name (optional)" } %> label: { text: "Name (optional)", size: "m" } %>
<%= f.govuk_email_field :email, <%= f.govuk_email_field :email,
label: { text: "Email address" }, label: { text: "Email address", size: "m" },
autocomplete: "email", autocomplete: "email",
spellcheck: "false", spellcheck: "false",
value: @resource.email %> value: @resource.email %>
@ -48,18 +48,17 @@
legend: { text: "Role", size: "m" } %> legend: { text: "Role", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_dpo, <%= f.govuk_collection_radio_buttons :is_dpo,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id, :id,
:name, :name,
inline: true, legend: { text: "Are #{pronoun(@user, current_user)} the organisation’s data protection officer?", size: "m" } %>
legend: { text: "Are #{pronoun(@user, current_user)} a data protection officer?", size: "m" } %>
<%= f.govuk_collection_radio_buttons :is_key_contact, <%= f.govuk_collection_radio_buttons :is_key_contact,
[OpenStruct.new(id: false, name: "No"), OpenStruct.new(id: true, name: "Yes")], [OpenStruct.new(id: true, name: "Yes"), OpenStruct.new(id: false, name: "No")],
:id, :id,
:name, :name,
inline: true, legend: { text: "Is this user a key contact for this service?", size: "m" },
legend: { text: "Are #{pronoun(@user, current_user)} a key contact?", 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>

Loading…
Cancel
Save