fix user count, change headline a bit

This commit is contained in:
jomo
2014-09-22 05:23:24 +02:00
parent 9cf5c6262c
commit beecf7a939
2 changed files with 12 additions and 8 deletions

View File

@@ -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

View File

@@ -1,10 +1,12 @@
<% if params[:role] %>
<h1><%= title "All '#{params[:role]}' role users" %></h1>
<%= link_to "show all", users_path %>
<% else %>
<h1><%= title "All Users" %></h1>
<% end %>
<p>User count: <%= User.count - 1 %></p>
<h1>
<% if params[:role] %>
<%= title "All #{params[:role]}-role users" %>
<% else %>
<%= title "All Users" %>
<% end %>
(<%= @count %>)
</h1>
<%= link_to "show all", users_path if params[:role] %>
<div id="userlist">
<% @users.each do |u| %>