From b5a40aa233cb7b2d6747665a844b03203196ebd2 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 27 Oct 2019 23:47:17 -0500 Subject: [PATCH] bulk update requests: list upvotes/downvotes on index page. --- .../bulk_update_requests_controller.rb | 2 +- .../bulk_update_requests/_listing.html.erb | 40 +++++++++++++------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/app/controllers/bulk_update_requests_controller.rb b/app/controllers/bulk_update_requests_controller.rb index 9ecbd807c..bd3e22a40 100644 --- a/app/controllers/bulk_update_requests_controller.rb +++ b/app/controllers/bulk_update_requests_controller.rb @@ -42,7 +42,7 @@ class BulkUpdateRequestsController < ApplicationController end 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) end diff --git a/app/views/bulk_update_requests/_listing.html.erb b/app/views/bulk_update_requests/_listing.html.erb index 4a4f20c7b..a7bf9910f 100644 --- a/app/views/bulk_update_requests/_listing.html.erb +++ b/app/views/bulk_update_requests/_listing.html.erb @@ -1,28 +1,44 @@ - - - - + + + <% bulk_update_requests.each do |request| %> - - + - - + +
CreatorApproverForumScriptRequestVotes StatusCreated
<%= link_to_user(request.user) %><% if request.approver %><%= link_to_user(request.approver) %><% end %> - <% if request.forum_post_id %> - <%= 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}")) %> - <% elsif request.forum_topic_id %> - <%= link_to(request.forum_topic_id, forum_topic_path(request.forum_topic_id)) %> + <% if request.forum_post.present? %> +

<%= 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}") %>

+ <% elsif request.forum_topic.present? %> +

<%= link_to "Topic ##{request.forum_topic_id}: #{request.forum_topic.title}", request.forum_topic %>

+ <% end %> + + <%= script_with_line_breaks(request.script) %> +
+ <% 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 %> <%= script_with_line_breaks(request.script) %><%= request.status %> + <%= request.status %> + <% if request.is_approved? %> +
by <%= link_to_user request.approver %> + <% end %> +
+ <%= link_to_user request.user %> + <%= link_to "ยป", bulk_update_requests_path(search: { user_name: request.user.name }) %> +
<%= time_ago_in_words_tagged(request.created_at) %>
+
<%= link_to "Show", bulk_update_request_path(request) %> | <%= render "bulk_update_requests/bur_edit_links", bur: request %>