<%= search_form_for(forum_post_votes_path) do |f| %> <%= f.input :creator_name, label: "Voter", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %> <%= f.simple_fields_for :forum_post do |fa| %> <%= fa.input :creator_name, label: "Forum Poster", input_html: { value: params.dig(:search, :forum_post, :creator_name), data: { autocomplete: "user" } } %> <% end %> <%= f.input :forum_post_id, label: "Forum Post", input_html: { value: params[:search][:forum_post_id] } %> <%= f.input :score, label: "Score", collection: [["+1", "1"], ["0", "0"], ["-1", "-1"]], include_blank: true, selected: params[:search][:score] %> <%= f.submit "Search" %> <% end %> <%= table_for @forum_post_votes, class: "striped autofit" do |t| %> <% t.column "Forum Post" do |forum_post_vote| %> <%= link_to "Forum ##{forum_post_vote.forum_post_id}", forum_post_vote.forum_post %> <%= link_to "»", forum_post_votes_path(search: { forum_post_id: forum_post_vote.forum_post_id }) %> <% end %> <% t.column "Forum Topic", td: {class: "col-expand"} do |forum_post_vote| %> <%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %> <% end %> <% t.column "Score" do |forum_post_vote| %> <%= link_to sprintf("%+d", forum_post_vote.score), forum_post_votes_path(search: { score: forum_post_vote.score }) %> <% end %> <% t.column "Forum Poster" do |forum_post_vote| %> <%= link_to_user forum_post_vote.forum_post.creator %> <%= link_to "»", forum_post_votes_path(search: { forum_post: { creator_name: forum_post_vote.forum_post.creator.name }}) %>
<%= time_ago_in_words_tagged(forum_post_vote.forum_post.created_at) %>
<% end %> <% t.column "Voter" do |forum_post_vote| %> <%= link_to_user forum_post_vote.creator %> <%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %>
<%= time_ago_in_words_tagged(forum_post_vote.created_at) %>
<% end %> <% t.column column: "control" do |forum_post_vote| %> <% if forum_post_vote.creator == CurrentUser.user %> <%= link_to "unvote", forum_post_vote_path(forum_post_vote, format: "js"), remote: true, method: :delete %> <% end %> <% end %> <% end %> <%= numbered_paginator(@forum_post_votes) %>