Skip to content

Commit

Permalink
Merge pull request #1468 from codidact/cellio/user-search-no-results
Browse files Browse the repository at this point in the history
when search turns up nothing, say so
  • Loading branch information
Oaphi authored Dec 6, 2024
2 parents 6b22ff8 + a8813ec commit f21fa8e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@
role: 'button', 'aria-label': 'Sort by age' %>
</div>

<div class="user-list">
<% @users.each do |user| %>
<%= render 'user', user: user %>
<% end %>
</div>
<% if @users.count == 0 %>
<p><%= I18n.t('search.no_users') %></p>
<% else %>
<div class="user-list">
<% @users.each do |user| %>
<%= render 'user', user: user %>
<% end %>
</div>
<% end %>

<%= will_paginate @users, renderer: BootstrapPagination::Rails %>
5 changes: 5 additions & 0 deletions config/locales/strings/en.search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
en:
search:
# used on the users page (not the main search)
no_users:
No users found.

0 comments on commit f21fa8e

Please sign in to comment.