add a flat version of the user tree, ordered by karma
This commit is contained in:
parent
33c204e5ca
commit
1af0edd268
|
@ -7,11 +7,16 @@ class UsersController < ApplicationController
|
|||
def tree
|
||||
@title = "Users"
|
||||
|
||||
if params[:by].to_s == "karma"
|
||||
@users = User.order("karma DESC, id ASC").to_a
|
||||
@user_count = @users.length
|
||||
render :action => "list"
|
||||
else
|
||||
users = User.order("id DESC").to_a
|
||||
|
||||
@user_count = users.length
|
||||
@users_by_parent = users.group_by(&:invited_by_user_id)
|
||||
end
|
||||
end
|
||||
|
||||
def invite
|
||||
@title = "Pass Along an Invitation"
|
||||
|
|
22
app/views/users/list.html.erb
Normal file
22
app/views/users/list.html.erb
Normal file
|
@ -0,0 +1,22 @@
|
|||
<div class="box wide">
|
||||
<p><strong>Users (<%= @user_count %>)</strong></p>
|
||||
|
||||
<ul class="user_tree">
|
||||
<% @users.each do |user| %>
|
||||
<li>
|
||||
<a href="/u/<%= user.username %>"
|
||||
<% if !user.is_active? %>
|
||||
class="inactive_user"
|
||||
<% elsif user.is_new? %>
|
||||
class="new_user"
|
||||
<% end %>
|
||||
><%= user.username %></a> (<%= user.karma %>)
|
||||
<% if user.is_admin? %>
|
||||
(administrator)
|
||||
<% elsif user.is_moderator? %>
|
||||
(moderator)
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
Loading…
Reference in a new issue