add a flat version of the user tree, ordered by karma
This commit is contained in:
parent
33c204e5ca
commit
1af0edd268
|
@ -7,10 +7,15 @@ class UsersController < ApplicationController
|
||||||
def tree
|
def tree
|
||||||
@title = "Users"
|
@title = "Users"
|
||||||
|
|
||||||
users = User.order("id DESC").to_a
|
if params[:by].to_s == "karma"
|
||||||
|
@users = User.order("karma DESC, id ASC").to_a
|
||||||
@user_count = users.length
|
@user_count = @users.length
|
||||||
@users_by_parent = users.group_by(&:invited_by_user_id)
|
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
|
end
|
||||||
|
|
||||||
def invite
|
def invite
|
||||||
|
|
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