diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f2e73cd..561171e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -21,7 +21,9 @@ class UsersController < ApplicationController else @users = User.where.not(id: User.first.id) #Remove first user end - @users = @users.order("role_id desc", "confirmed desc", :name).page(params[:page]) + @users = @users.order("role_id desc", "confirmed desc", :name) + @count = @users.length + @users = @users.page(params[:page]) end def show diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index 74d1bdd..6f1554f 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -1,10 +1,12 @@ -<% if params[:role] %> -

<%= title "All '#{params[:role]}' role users" %>

- <%= link_to "show all", users_path %> -<% else %> -

<%= title "All Users" %>

-<% end %> -

User count: <%= User.count - 1 %>

+

+ <% if params[:role] %> + <%= title "All #{params[:role]}-role users" %> + <% else %> + <%= title "All Users" %> + <% end %> + (<%= @count %>) +

+<%= link_to "show all", users_path if params[:role] %>
<% @users.each do |u| %>