diff --git a/app/components/comment_component/comment_component.html.erb b/app/components/comment_component/comment_component.html.erb index 3b70a21cc..71e1bf9aa 100644 --- a/app/components/comment_component/comment_component.html.erb +++ b/app/components/comment_component/comment_component.html.erb @@ -53,7 +53,13 @@ <%= link_to upvote_icon, comment_comment_votes_path(comment_id: comment.id, score: "1"), class: "comment-upvote-link inactive-link", method: :post, remote: true %> <% end %> - <%= comment.score %> + <% if policy(CommentVote).can_see_votes? %> + <%= link_to comment_votes_path(search: { comment_id: comment.id }, variant: "compact"), class: "inactive-link" do %> + <%= comment.score %> + <% end %> + <% else %> + <%= comment.score %> + <% end %> <% if current_user.is_anonymous? %> <%= link_to downvote_icon, login_path(url: request.fullpath), class: "comment-downvote-link inactive-link" %> diff --git a/app/views/comment_votes/_search.html.erb b/app/views/comment_votes/_search.html.erb new file mode 100644 index 000000000..2fcdde6a0 --- /dev/null +++ b/app/views/comment_votes/_search.html.erb @@ -0,0 +1,11 @@ +<%= 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" } %> + <%= fc.input :post_id, label: "Post", input_html: { value: params.dig(:search, :comment, :post_id) } %> + <% end %> + <%= f.input :comment_id, label: "Comment", input_html: { value: params[:search][:comment_id] } %> + <%= f.input :score, collection: [["+1", "1"], ["-1", "-1"]], include_blank: true, selected: params[:search][:score] %> + <%= f.submit "Search" %> +<% end %> diff --git a/app/views/comment_votes/index.html+compact.erb b/app/views/comment_votes/index.html+compact.erb new file mode 100644 index 000000000..053c3b37e --- /dev/null +++ b/app/views/comment_votes/index.html+compact.erb @@ -0,0 +1,24 @@ +<%= render "comments/secondary_links" %> + +