diff --git a/app/helpers/tab_nav_helper.rb b/app/helpers/tab_nav_helper.rb index 1411b6767..376424c7e 100644 --- a/app/helpers/tab_nav_helper.rb +++ b/app/helpers/tab_nav_helper.rb @@ -2,7 +2,8 @@ module TabNavHelper include GovukLinkHelper def user_cell(user) - [govuk_link_to(user.name, user, class: "govuk-!-font-weight-bold"), user.email].join("\n") + link_text = user.name.presence || user.email + [govuk_link_to(link_text, user, class: "govuk-!-font-weight-bold"), user.email].join("\n") end def org_cell(user) diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index c1bdee263..a84f0d634 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -17,7 +17,8 @@ <%= f.govuk_text_field :name, - autocomplete: "name" %> + autocomplete: "name", + label: { text: "Name (optional)" } %> <%= f.govuk_email_field :email, label: { text: "Email address" }, diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index af0aa0599..94446f9d0 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,4 +1,4 @@ -<% content_for :title, current_user == @user ? "Your account" : "#{@user.name}’s account" %> +<% content_for :title, current_user == @user ? "Your account" : "#{@user.name.presence || @user.email}’s account" %>