Skip to content

Commit

Permalink
Show user status as tag instead of strikethrough
Browse files Browse the repository at this point in the history
The strikethrough is not part of the design system, so we've decided to
use the govuk-tag style instead.

The design on the card showed green for active users, grey for suspended
users, but there were no examples of locked or invited users.

I've chosen to only use green for active users, and grey for all other
statuses.

The CSV export of the users needs to stay in plain text.
  • Loading branch information
CristinaRO committed Feb 13, 2024
1 parent 9781257 commit 39b356b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ module UsersHelper
include Pundit::Authorization

def status(user)
user.status.humanize
css_classes = if user.status == User::USER_STATUS_ACTIVE
"govuk-tag--green"
else
"govuk-tag--grey"
end

govuk_tag(user.status.humanize, css_classes)
end

def two_step_status(user)
Expand Down Expand Up @@ -67,8 +73,7 @@ def assignable_user_roles
end

def user_name(user)
anchor_tag = link_to(user.name, edit_user_path(user), class: "govuk-link")
user.suspended? ? content_tag(:del, anchor_tag) : anchor_tag
link_to(user.name, edit_user_path(user), class: "govuk-link")
end

def options_for_role_select(selected: nil)
Expand Down
2 changes: 1 addition & 1 deletion app/presenters/user_export_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def row(user)
user.sign_in_count,
user.current_sign_in_at.try(:to_formatted_s, :db),
user.created_at.try(:to_formatted_s, :db),
status(user),
user.status.humanize,
two_step_status(user),
user.expiry_date_for_2sv_exemption.try(:strftime, "%d/%m/%Y"),
].concat(app_permissions_for(user))
Expand Down

0 comments on commit 39b356b

Please sign in to comment.