journalduhacker/app/views/users/tree.html.erb
joshua stein 22b77573a5 prevent new users from downvoting
don't show downvote arrows for logged-out and new users

color comments from new users in green like in the user tree,
and banned users in gray
2014-01-12 23:17:09 -06:00

42 lines
1.1 KiB
Plaintext

<div class="box wide">
<p><strong>Users (<%= @user_count %>)</strong></p>
<ul class="root">
<% subtree = @users_by_parent[nil] %>
<% ancestors = [] %>
<% while subtree %>
<% if (user = subtree.pop) %>
<li>
<a href="/u/<%= user.username %>"
<% if user.is_banned? %>
class="banned_user"
<% elsif user.is_new? %>
class="new_user"
<% end %>
><%= user.username %></a>&nbsp;(<%= user.karma %>)
<% if user.is_admin? %>
(administrator)
<% elsif user.is_moderator? %>
(moderator)
<% end %>
<% if (children = @users_by_parent[user.id]) %>
<% # drill down deeper in the tree %>
<% ancestors << subtree %>
<% subtree = children %>
<ul class="user_tree">
<% else %>
</li>
<% end %>
<% else %>
<% # climb back out %>
<% subtree = ancestors.pop %>
<% if subtree %>
</ul></li>
<% end %>
<% end %>
<% end %>
</ul>
</div>