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.
  • Loading branch information
CristinaRO committed Feb 13, 2024
1 parent 9781257 commit a90e385
Showing 1 changed file with 8 additions and 3 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"

Check failure on line 6 in app/helpers/users_helper.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/IndentationWidth: Use 2 (not -12) spaces for indentation. (https://rubystyle.guide#spaces-indentation)
else

Check failure on line 7 in app/helpers/users_helper.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/ElseAlignment: Align `else` with `if`.
"govuk-tag--grey"
end

Check failure on line 9 in app/helpers/users_helper.rb

View workflow job for this annotation

GitHub Actions / Lint Ruby / Run RuboCop

Layout/EndAlignment: `end` at 9, 4 is not aligned with `if` at 5, 18.

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

0 comments on commit a90e385

Please sign in to comment.