From d1f01edb3b034bb9ba6c1916e8d211ec48367b82 Mon Sep 17 00:00:00 2001 From: kiddhustle Date: Fri, 29 Apr 2022 12:00:40 +0100 Subject: [PATCH] git CLDC-1183: use email where no user name --- app/helpers/tab_nav_helper.rb | 3 ++- app/views/users/new.html.erb | 3 ++- app/views/users/show.html.erb | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) 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" %>
@@ -9,7 +9,6 @@

Personal details

- <%= govuk_summary_list do |summary_list| %> <%= summary_list.row do |row| row.key { "Name" }