Files
danbooru/app/views/comment_votes/index.html.erb
evazion 5c913d8ad1 table builder: fix various incorrect css classes.
Change calling convention to explicitly indicate whether the attributes
are for the <th> element or the <td> element. Fixes various cases where
the two were mixed up.

* Fix .col-expand classes not being set correctly on the /post_versions,
  /pool_versions, and /notes pages.

* Fix .updater and .updated-at classes not being set correctly on the
  /forum_topics page.

* Fix the name param being ignored (noticeable in the post count field
  on the /tags page).

* Don't pass empty string when column has no name.
2020-01-07 02:40:59 -06:00

45 lines
2.1 KiB
Plaintext

<div id="c-comment-votes">
<div id="a-index">
<%= search_form_for(comment_votes_path) do |f| %>
<%= f.input :user_name, label: "Voter", input_html: { value: params[:search][:user_name], "data-autocomplete": "user" } %>
<%= f.simple_fields_for :comment do |fc| %>
<%= fc.input :creator_name, label: "Commenter", input_html: { value: params.dig(:search, :comment, :creator_name), "data-autocomplete": "user" } %>
<%= fc.input :post_tags_match, label: "Tags", input_html: { value: params.dig(:search, :comment, :post_tags_match), "data-autocomplete": "tag-query" } %>
<% end %>
<%= f.input :score, collection: [["+1", "1"], ["-1", "-1"]], include_blank: true, selected: params[:search][:score] %>
<%= f.submit "Search" %>
<% end %>
<%= table_for @comment_votes, {class: "striped autofit"} do |t| %>
<% t.column "Post" do |vote| %>
<%= PostPresenter.preview(vote.comment.post, show_deleted: true) %>
<% end %>
<% t.column "Comment", td: {class: "col-expand"} do |vote| %>
<div class="prose">
<%= format_text(vote.comment.body) %>
</div>
<% end %>
<% t.column "Score" do |vote| %>
<%= link_to sprintf("%+d", vote.score), comment_votes_path(search: { score: vote.score }) %>
<% end %>
<% t.column "Commenter" do |vote| %>
<%= link_to_user vote.comment.creator %>
<%= link_to "»", comment_votes_path(search: { comment: { creator_name: vote.comment.creator_name }}) %>
<div><%= time_ago_in_words_tagged(vote.comment.created_at) %></div>
<% end %>
<% t.column "Voter" do |vote| %>
<%= link_to_user vote.user %>
<%= link_to "»", comment_votes_path(search: { user_name: vote.user.name }) %>
<div><%= time_ago_in_words_tagged(vote.created_at) %></div>
<% end %>
<% t.column do |vote| %>
<% if vote.user == CurrentUser.user %>
<%= link_to "unvote", comment_comment_votes_path(vote.comment), remote: true, method: :delete %>
<% end %>
<% end %>
<% end %>
<%= numbered_paginator(@comment_votes) %>
</div>
</div>