/post_{flags,appeals}: add uploader, approver, flag/appeal count columns.
Also include '»' links next to uploader/approver names for drilling down the search by a given user.
This commit is contained in:
@@ -8,8 +8,8 @@ class PostAppealsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@query = PostAppeal.order("post_appeals.id desc").includes(:post).search(params[:search])
|
||||
@post_appeals = @query.paginate(params[:page], :limit => params[:limit])
|
||||
@post_appeals = PostAppeal.includes(:creator).search(params[:search]).includes(post: [:appeals, :uploader, :approver])
|
||||
@post_appeals = @post_appeals.paginate(params[:page], limit: params[:limit])
|
||||
respond_with(@post_appeals) do |format|
|
||||
format.xml do
|
||||
render :xml => @post_appeals.to_xml(:root => "post-appeals")
|
||||
|
||||
@@ -8,8 +8,8 @@ class PostFlagsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@query = PostFlag.order("id desc").search(params[:search])
|
||||
@post_flags = @query.paginate(params[:page], :limit => params[:limit])
|
||||
@post_flags = PostFlag.search(params[:search]).includes(:creator, post: [:flags, :uploader, :approver])
|
||||
@post_flags = @post_flags.paginate(params[:page], limit: params[:limit])
|
||||
respond_with(@post_flags) do |format|
|
||||
format.xml do
|
||||
render :xml => @post_flags.to_xml(:root => "post-flags")
|
||||
|
||||
@@ -37,7 +37,7 @@ class PostAppeal < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = where("true")
|
||||
q = order("post_appeals.id desc")
|
||||
return q if params.blank?
|
||||
|
||||
if params[:reason_matches].present?
|
||||
|
||||
@@ -45,7 +45,7 @@ class PostFlag < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def search(params)
|
||||
q = where("true")
|
||||
q = order("post_flags.id desc")
|
||||
return q if params.blank?
|
||||
|
||||
if params[:reason_matches].present?
|
||||
|
||||
@@ -7,20 +7,44 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%">Post</th>
|
||||
<th width="10%">Creator</th>
|
||||
<th>Reason</th>
|
||||
<th width="15%">Date</th>
|
||||
<th width="1%">Appeals</th>
|
||||
<th width="5%">Resolved?</th>
|
||||
<th width="15%">Uploaded</th>
|
||||
<th width="15%">Appealed</th>
|
||||
<th width="15%">Approver</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @post_appeals.each do |post_appeal| %>
|
||||
<tr>
|
||||
<td><%= PostPresenter.preview(post_appeal.post, :tags => "status:any") %></td>
|
||||
<td><%= link_to_user post_appeal.creator %></td>
|
||||
<td><%= format_text post_appeal.reason, :ragel => true %></td>
|
||||
<td><%= compact_time post_appeal.updated_at %></td>
|
||||
<td><%= post_appeal.resolved? %></td>
|
||||
<td>
|
||||
<%= link_to post_appeal.post.appeals.size, post_appeals_path(search: { post_id: post_appeal.post_id }) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to post_appeal.is_resolved.to_s, post_appeals_path(search: params[:search].merge(is_resolved: post_appeal.is_resolved)) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= compact_time post_appeal.post.created_at %>
|
||||
<br> by <%= link_to_user post_appeal.post.uploader %>
|
||||
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} user:#{post_appeal.post.uploader.name}".strip)) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= compact_time post_appeal.created_at %>
|
||||
<br> by <%= link_to_user post_appeal.creator %>
|
||||
<%= link_to "»", post_appeals_path(search: params[:search].merge(creator_name: post_appeal.creator.name)) %>
|
||||
</td>
|
||||
<td>
|
||||
<% if post_appeal.post.approver %>
|
||||
<%= link_to_user post_appeal.post.approver %>
|
||||
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:#{post_appeal.post.approver.name}".strip)) %>
|
||||
<% else %>
|
||||
<em>none</em>
|
||||
<%= link_to "»", post_appeals_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:none".strip)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
@@ -6,25 +6,53 @@
|
||||
<table width="100%" class="striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="1%"></th>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
<th width="10%">Creator</th>
|
||||
<% end %>
|
||||
<th width="1%">Post</th>
|
||||
<th>Reason</th>
|
||||
<th width="15%">Date</th>
|
||||
<th width="1%">Flags</th>
|
||||
<th width="1%">Category</th>
|
||||
<th width="1%">Resolved?</th>
|
||||
<th width="15%">Uploaded</th>
|
||||
<th width="15%">Flagged</th>
|
||||
<th width="15%">Approver</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @post_flags.each do |post_flag| %>
|
||||
<tr class="resolved-<%= post_flag.is_resolved? %>">
|
||||
<td><%= PostPresenter.preview(post_flag.post, :tags => "status:any") %></td>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
<td>
|
||||
<%= link_to_user post_flag.creator %>
|
||||
</td>
|
||||
<% end %>
|
||||
<td><%= format_text post_flag.reason, :ragel => true %></td>
|
||||
<td><%= compact_time post_flag.updated_at %></td>
|
||||
<td>
|
||||
<%= format_text post_flag.reason, :ragel => true %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to post_flag.post.flags.size, post_flags_path(search: { post_id: post_flag.post_id }) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to post_flag.category.to_s, post_flags_path(search: params[:search].merge(category: post_flag.category)) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to post_flag.is_resolved?.to_s, post_flags_path(search: params[:search].merge(is_resolved: post_flag.is_resolved?)) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= compact_time post_flag.post.created_at %>
|
||||
<br> by <%= link_to_user post_flag.post.uploader %>
|
||||
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} user:#{post_flag.post.uploader.name}".strip)) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= compact_time post_flag.created_at %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
<br> by <%= link_to_user post_flag.creator %>
|
||||
<%= link_to "»", post_flags_path(search: params[:search].merge(creator_name: post_flag.creator.name)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<% if post_flag.post.approver %>
|
||||
<%= link_to_user post_flag.post.approver %>
|
||||
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:#{post_flag.post.approver.name}".strip)) %>
|
||||
<% else %>
|
||||
<em>none</em>
|
||||
<%= link_to "»", post_flags_path(search: params[:search].merge(post_tags_match: "#{params[:search][:post_tags_match]} approver:none".strip)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user