41 lines
1.9 KiB
Plaintext
41 lines
1.9 KiB
Plaintext
<div id="c-post-votes">
|
|
<div id="a-index">
|
|
<%= search_form_for(post_votes_path) do |f| %>
|
|
<%= f.input :user_name, label: "Voter", input_html: { value: params[:search][:user_name], "data-autocomplete": "user" } %>
|
|
<%= f.input :post_id, label: "Post", input_html: { value: params[:search][:post_id] } %>
|
|
<%= f.input :post_tags_match, label: "Tags", input_html: { value: params[:search][:post_tags_match], "data-autocomplete": "tag-query" } %>
|
|
<%= f.input :score, collection: [["+3", "3"], ["+1", "1"], ["-1", "-1"], ["-3", "-3"]], include_blank: true, selected: params[:search][:score] %>
|
|
<%= f.submit "Search" %>
|
|
<% end %>
|
|
|
|
<%= table_for @post_votes, class: "striped autofit" do |t| %>
|
|
<% t.column "Post" do |vote| %>
|
|
<%= PostPresenter.preview(vote.post, show_deleted: true) %>
|
|
<% end %>
|
|
<% t.column "Tags", td: {class: "col-expand"} do |vote| %>
|
|
<%= TagSetPresenter.new(vote.post.tag_array).inline_tag_list_html %>
|
|
<% end %>
|
|
<% t.column "Score" do |vote| %>
|
|
<%= link_to sprintf("%+d", vote.score), post_votes_path(search: { score: vote.score }) %>
|
|
<% end %>
|
|
<% t.column "Uploader" do |vote| %>
|
|
<%= link_to_user vote.post.uploader %>
|
|
<%= link_to "»", post_votes_path(search: { post_tags_match: "user:#{vote.post.uploader.name}" }) %>
|
|
<div><%= time_ago_in_words_tagged(vote.post.created_at) %></div>
|
|
<% end %>
|
|
<% t.column "Voter" do |vote| %>
|
|
<%= link_to_user vote.user %>
|
|
<%= link_to "»", post_votes_path(search: { user_name: vote.user.name }) %>
|
|
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
|
|
<% end %>
|
|
<% t.column column: "control" do |vote| %>
|
|
<% if vote.user == CurrentUser.user %>
|
|
<%= link_to "unvote", post_post_votes_path(vote.post), remote: true, method: :delete %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<%= numbered_paginator(@post_votes) %>
|
|
</div>
|
|
</div>
|