forum post votes: add index page.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
<li class="vote-score-<%= vote.vote_type %>">
|
||||
<% if forum_post.tag_change_request && forum_post.tag_change_request.is_pending? && vote.creator_id == CurrentUser.id %>
|
||||
<%= link_to content_tag(:i, nil, class: "far #{vote.fa_class}"), forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :delete %>
|
||||
<%= link_to content_tag(:i, nil, class: "far #{vote.fa_class}"), forum_post_vote_path(vote, format: "js"), remote: true, method: :delete %>
|
||||
<%= link_to_user vote.creator %>
|
||||
<% else %>
|
||||
<%= content_tag(:i, nil, class: "far #{vote.fa_class}") %>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Danbooru.notice("Unvoted");
|
||||
var code = <%= raw render(partial: "forum_post_votes/list", locals: {forum_post: @forum_post, votes: @forum_post.votes}).to_json %>;
|
||||
$("#forum-post-votes-for-<%= @forum_post.id %>").html(code);
|
||||
var code = <%= raw render(partial: "forum_post_votes/list", locals: {forum_post: @forum_post_vote.forum_post, votes: @forum_post_vote.forum_post.votes}).to_json %>;
|
||||
$("#forum-post-votes-for-<%= @forum_post_vote.forum_post_id %>").html(code);
|
||||
|
||||
44
app/views/forum_post_votes/index.html.erb
Normal file
44
app/views/forum_post_votes/index.html.erb
Normal file
@@ -0,0 +1,44 @@
|
||||
<div id="c-forum-post-votes">
|
||||
<div id="a-index">
|
||||
<%= search_form_for(forum_post_votes_path) do |f| %>
|
||||
<%= f.input :creator_name, label: "User", input_html: { value: params[:search][:creator_name], data: { autocomplete: "user" } } %>
|
||||
<%= f.input :forum_post_id, label: "Forum Post", input_html: { value: params[:search][:forum_post_id] } %>
|
||||
<%= f.input :score, label: "Type", collection: [["Up", "1"], ["Meh", "0"], ["Down", "-1"]], include_blank: true, selected: params[:search][:score] %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<table class="striped autofit">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Forum Post</th>
|
||||
<th>Forum Topic</th>
|
||||
<th>Type</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @forum_post_votes.each do |forum_post_vote| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= 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 }) %>
|
||||
</td>
|
||||
<td class="col-expand">
|
||||
<%= link_to forum_post_vote.forum_post.topic.title, forum_post_vote.forum_post.topic %>
|
||||
</td>
|
||||
<td>
|
||||
<%= forum_post_vote.vote_type %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to_user forum_post_vote.creator %>
|
||||
<%= link_to "»", forum_post_votes_path(search: { creator_name: forum_post_vote.creator.name }) %>
|
||||
<p><%= time_ago_in_words_tagged(forum_post_vote.updated_at) %></p>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= numbered_paginator(@forum_post_votes) %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -94,6 +94,7 @@
|
||||
<li><%= link_to("Help", wiki_pages_path(:title => "help:forum")) %></li>
|
||||
<li><%= link_to("Listing", forum_topics_path) %></li>
|
||||
<li><%= link_to("Search", search_forum_posts_path) %></li>
|
||||
<li><%= link_to("Votes", forum_post_votes_path) %></li>
|
||||
<li><%= link_to("RSS", forum_topics_path(:atom)) %></li>
|
||||
</ul>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user