bulk update requests: list upvotes/downvotes on index page.
This commit is contained in:
@@ -42,7 +42,7 @@ class BulkUpdateRequestsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@bulk_update_requests = BulkUpdateRequest.paginated_search(params)
|
@bulk_update_requests = BulkUpdateRequest.includes(:user, :approver, :forum_topic, forum_post: [:votes]).paginated_search(params)
|
||||||
respond_with(@bulk_update_requests)
|
respond_with(@bulk_update_requests)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,44 @@
|
|||||||
<table class="striped" width="100%">
|
<table class="striped" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Creator</th>
|
<th>Request</th>
|
||||||
<th>Approver</th>
|
<th>Votes</th>
|
||||||
<th>Forum</th>
|
|
||||||
<th>Script</th>
|
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
|
<th>Created</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% bulk_update_requests.each do |request| %>
|
<% bulk_update_requests.each do |request| %>
|
||||||
<tr id="request-<%= request.id %>">
|
<tr id="request-<%= request.id %>">
|
||||||
<td><%= link_to_user(request.user) %></td>
|
|
||||||
<td><% if request.approver %><%= link_to_user(request.approver) %><% end %></td>
|
|
||||||
<td>
|
<td>
|
||||||
<% if request.forum_post_id %>
|
<% if request.forum_post.present? %>
|
||||||
<%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id, page: request.forum_post.forum_topic_page, :anchor => "forum_post_#{request.forum_post.id}")) %>
|
<p><%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", forum_topic_path(request.forum_topic_id, page: request.forum_post.forum_topic_page, anchor: "forum_post_#{request.forum_post_id}") %></p>
|
||||||
<% elsif request.forum_topic_id %>
|
<% elsif request.forum_topic.present? %>
|
||||||
<%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id)) %>
|
<p><%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", request.forum_topic %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= script_with_line_breaks(request.script) %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if request.forum_post.present? %>
|
||||||
|
<%= link_to forum_post_votes_path(search: { forum_post_id: request.forum_post_id }) do %>
|
||||||
|
+<%= request.forum_post.votes.select(&:up?).count %> /
|
||||||
|
-<%= request.forum_post.votes.select(&:down?).count %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= script_with_line_breaks(request.script) %></td>
|
<td id="request-status-for-<%= request.id %>">
|
||||||
<td id="request-status-for-<%= request.id %>"><%= request.status %></td>
|
<%= request.status %>
|
||||||
|
<% if request.is_approved? %>
|
||||||
|
<br>by <%= link_to_user request.approver %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= link_to_user request.user %>
|
||||||
|
<%= link_to "»", bulk_update_requests_path(search: { user_name: request.user.name }) %>
|
||||||
|
<div><%= time_ago_in_words_tagged(request.created_at) %></div>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to "Show", bulk_update_request_path(request) %> |
|
<%= link_to "Show", bulk_update_request_path(request) %> |
|
||||||
<%= render "bulk_update_requests/bur_edit_links", bur: request %>
|
<%= render "bulk_update_requests/bur_edit_links", bur: request %>
|
||||||
|
|||||||
Reference in New Issue
Block a user