diff --git a/app/views/users/_user_list.html.erb b/app/views/users/_user_list.html.erb index f1719b15c..6c0cc988a 100644 --- a/app/views/users/_user_list.html.erb +++ b/app/views/users/_user_list.html.erb @@ -1,9 +1,8 @@ <%= govuk_table do |table| %> <%= table.caption(classes: %w[govuk-!-font-size-19 govuk-!-font-weight-regular]) do |caption| %> - <% if searched %> - <% item_label = pagy.count > 1 ? "users" : "user" %> - <%= pagy.count %> <%= item_label %> found matching ‘<%= searched %>’ of <%= User.count %> total users. <%= govuk_link_to("Clear search", request.path) %> + <% if searched.present? %> + <%= pagy.count %> <%= item_label %> found matching ‘<%= searched %>’ of <%= total_user_count %> total users. <%= govuk_link_to("Clear search", request.path) %> <% else %> <%= pagy.count %> total users. <% end %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index a29bb8211..444f0ac05 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,7 +1,12 @@ <% if @searched.present? %> - <% search_title = " (search results for ‘#{@searched})’" %> + <% item_label = @pagy.count > 1 ? "users" : "user" %> + <% total_user_count = User.all.count %> + <% title = "Your organisation (#{@pagy.count} #{item_label} matching ‘#{@searched}’ of #{total_user_count} total users)" %> +<% else %> + <% item_label = "" %> + <% total_user_count = nil %> + <% title = "Your organisation (Users)" %> <% end %> -<% title = "Your organisation (Users)#{search_title}" %> <% content_for :title, title %> @@ -15,5 +20,5 @@ <%= render SearchComponent.new(current_user:, search_label: "Search by name or email address", value: @searched) %> -<%= render partial: "users/user_list", locals: { users: @users, title:, pagy: @pagy, searched: @searched } %> +<%= render partial: "users/user_list", locals: { users: @users, title:, pagy: @pagy, searched: @searched, item_label:, total_user_count: } %> <%== render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "users" } %>