Skip to content

Commit

Permalink
add status to user list if admin to facilitate suspend/unsuspend
Browse files Browse the repository at this point in the history
  • Loading branch information
hamp committed Oct 3, 2008
1 parent aae0fb3 commit 8044ccc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 5 additions & 1 deletion app/controllers/users_controller.rb
Expand Up @@ -4,7 +4,11 @@ class UsersController < ApplicationController
before_filter :login_required, :only => [:settings, :update]

def index
@users = current_site.users.paginate :all, :page => current_page
@users = if admin?
current_site.all_users.paginate :all, :page => current_page
else
current_site.users.paginate :all, :page => current_page
end
end

# render new.rhtml
Expand Down
11 changes: 7 additions & 4 deletions app/views/users/index.html.erb
@@ -1,4 +1,3 @@
<% content_for :right do %>
<h5><%= 'Find a User'[] %></h5>

<% form_tag users_path, :method => 'get' do -%>
Expand All @@ -8,8 +7,6 @@
<%= submit_tag "Search"[:search_title] %></p>
<% end -%>

<% end -%>

<h1 style="margin-top:0;"><%= 'Users'[:users_title] %></h1>
<p class="subtitle">
<%= user_count %>, <%= active_user_count %>, <%= lurking_user_count %>
Expand All @@ -20,6 +17,9 @@
<table border="0" cellspacing="0" cellpadding="0" class="wide forums">
<tr>
<th class="la" width="88%"><%= 'Name / Login'[:name_or_login] %></th>
<% if logged_in? && current_user.admin? -%>
<th><%= "Current Status"[:current_status_title] %></th>
<% end -%>
<th><%= 'Website'[:website_title] %></th>
<th width="1%"><%= 'Posts'[:posts_title] %></th>
</tr>
Expand All @@ -29,7 +29,10 @@
<span style="color:#666">
<%= "(admin)"[:admin_in_parens] if user.admin? %>
</span>
</td>
</td>
<% if logged_in? && current_user.admin? -%>
<td><%= user.state %></td>
<% end -%>
<td class="la">
<% unless user.website.blank? %>
<%= sanitize link_to(user.website.gsub("http://",""), "http://" + user.website.gsub("http://","")) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.html.erb
Expand Up @@ -52,7 +52,7 @@
<%= '{count} topics'[(count=@user.topics.size)==1 ? :topic_count : :topics_count, number_with_delimiter(count)] %>,
<%= '{count} posts'[(count=@user.posts.size)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %>
(<%= 'view'[] %> <%= link_to 'all'[:view_all], user_posts_path(@user) %> |
<%= link_to 'monitored'[], "monitored_posts_path(@user)" %> <%= 'posts'[] %>)<br />
<%= link_to 'monitored'[], "#" %> <%= 'posts'[] %>)<br />
</span>
</p>

Expand Down

0 comments on commit 8044ccc

Please sign in to comment.