forked from e621ng/e621ng
[AIBUR] Link to forum post & show votes in show
action (#601)
* [AIBUR] Link to forum post & show votes in `show` action * Use strict locals, they are pretty cool Also clarify the purpose of the new parameter * Only show voting box when any votes are present Looks weird otherwise * Move the list into the partial * Remove voting link on show page * Uniform display on forum/show page Display the votes inline, like on forum posts --------- Co-authored-by: Earlopain <14981592+Earlopain@users.noreply.github.com>
This commit is contained in:
parent
5759cc4103
commit
0702b4fd19
@ -38,16 +38,24 @@ div.list-of-forum-posts {
|
||||
menu {
|
||||
margin-top: 0.5em;
|
||||
|
||||
ul.votes {
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
.forum-post-votes-list {
|
||||
margin-top: 0.5em;
|
||||
margin-left: 0.2em;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.forum-post-votes-list {
|
||||
li {
|
||||
display: inline;
|
||||
margin-right: 1em;
|
||||
}
|
||||
}
|
||||
|
||||
div#c-forum-topics {
|
||||
|
@ -3,9 +3,7 @@
|
||||
<h1>Bulk Update Request: <%= @bulk_update_request.title %></h1>
|
||||
|
||||
<ul>
|
||||
<% if @bulk_update_request.forum_topic_id %>
|
||||
<li><strong>Reference</strong> <%= link_to "topic ##{@bulk_update_request.forum_topic_id}", forum_topic_path(@bulk_update_request.forum_topic_id) %></li>
|
||||
<% end %>
|
||||
<%= render "tag_change_requests/reference", tag_change_request: @bulk_update_request %>
|
||||
<li><strong>Creator</strong> <%= link_to_user @bulk_update_request.user %></li>
|
||||
<li><strong>Date</strong> <%= @bulk_update_request.created_at %></li>
|
||||
<li><strong>Status</strong>: <%= @bulk_update_request.status %></li>
|
||||
@ -18,6 +16,8 @@
|
||||
|
||||
<%= render "bur_edit_links", bur: @bulk_update_request %>
|
||||
</div>
|
||||
|
||||
<%= render "tag_change_requests/votes", tag_change_request: @bulk_update_request %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
<%-
|
||||
# votes
|
||||
# forum_post
|
||||
%>
|
||||
<%# locals: (votes:, forum_post:, votable: true) -%>
|
||||
|
||||
<% own_vote = votes.find { |vote| vote.creator == CurrentUser.user } %>
|
||||
<% other_votes = votes.reject { |vote| vote.creator == CurrentUser.user } %>
|
||||
|
||||
<% if own_vote %>
|
||||
<%= render "forum_post_votes/vote", vote: own_vote, forum_post: forum_post %>
|
||||
<% end %>
|
||||
<ul class="forum-post-votes-list" id="forum-post-votes-for-<%= forum_post.id %>">
|
||||
<% if own_vote %>
|
||||
<%= render "forum_post_votes/vote", vote: own_vote, forum_post: forum_post, votable: votable %>
|
||||
<% end %>
|
||||
|
||||
<% other_votes.each do |vote| %>
|
||||
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post %>
|
||||
<% end %>
|
||||
<% other_votes.each do |vote| %>
|
||||
<%= render "forum_post_votes/vote", vote: vote, forum_post: forum_post, votable: false %>
|
||||
<% end %>
|
||||
|
||||
<% if forum_post.tag_change_request&.is_pending? && !own_vote %>
|
||||
<% if forum_post.tag_change_request&.is_pending? && !own_vote && votable %>
|
||||
<%= render "forum_post_votes/add_vote", forum_post: forum_post %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -1,10 +1,7 @@
|
||||
<%-
|
||||
# vote
|
||||
# forum_post
|
||||
%>
|
||||
<%# locals: (vote:, forum_post:, votable:) -%>
|
||||
|
||||
<li class="vote-score-<%= vote.vote_type %> <%= 'own-forum-vote' if vote.creator_id == CurrentUser.id %>">
|
||||
<% if forum_post.tag_change_request&.is_pending? && vote.creator_id == CurrentUser.id %>
|
||||
<% if votable && forum_post.tag_change_request&.is_pending? && vote.creator_id == CurrentUser.id %>
|
||||
<%= link_to tag.i(class: "fa-regular #{vote.fa_class}"), "#", class: "forum-vote-remove", 'data-forum-id': forum_post.id %>
|
||||
<%= link_to_user vote.creator %>
|
||||
<% else %>
|
||||
|
@ -73,12 +73,10 @@
|
||||
<span><%= link_to_ip forum_post.creator_ip_addr %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% if forum_post.votable? %>
|
||||
<ul class="votes" id="forum-post-votes-for-<%= forum_post.id %>">
|
||||
<%= render "forum_post_votes/list", votes: forum_post.votes, forum_post: forum_post %>
|
||||
</ul>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% if forum_post.votable? %>
|
||||
<%= render "forum_post_votes/list", votes: forum_post.votes, forum_post: forum_post %>
|
||||
<% end %>
|
||||
<% if forum_post.editable_by?(CurrentUser.user) %>
|
||||
<% if forum_post.is_original_post?(original_forum_post_id) %>
|
||||
<%= render "forum_topics/form", :forum_topic => forum_post.topic %>
|
||||
|
@ -5,9 +5,7 @@
|
||||
<ul>
|
||||
<li><strong>From</strong> <%= link_to @tag_alias.antecedent_name, show_or_new_wiki_pages_path(:title => @tag_alias.antecedent_name) %></li>
|
||||
<li><strong>To</strong> <%= link_to @tag_alias.consequent_name, show_or_new_wiki_pages_path(:title => @tag_alias.consequent_name) %></li>
|
||||
<% if @tag_alias.forum_topic_id %>
|
||||
<li><strong>Reference</strong> <%= link_to "topic ##{@tag_alias.forum_topic_id}", forum_topic_path(@tag_alias.forum_topic_id) %></li>
|
||||
<% end %>
|
||||
<%= render "tag_change_requests/reference", tag_change_request: @tag_alias %>
|
||||
<li><strong>Creator</strong> <%= link_to_user @tag_alias.creator %></li>
|
||||
<li><strong>Date</strong> <%= @tag_alias.created_at %></li>
|
||||
<% if @tag_alias.respond_to?(:reason) && @tag_alias.reason.present? %>
|
||||
@ -32,6 +30,8 @@
|
||||
<%= render "tag_relationships/command_buttons", tag_relation: @tag_alias, with_show_link: false %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<%= render "tag_change_requests/votes", tag_change_request: @tag_alias %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
9
app/views/tag_change_requests/_reference.html.erb
Normal file
9
app/views/tag_change_requests/_reference.html.erb
Normal file
@ -0,0 +1,9 @@
|
||||
<% if tag_change_request.forum_topic_id %>
|
||||
<li><strong>Reference</strong>
|
||||
<% if tag_change_request.forum_post_id %>
|
||||
<%= link_to "forum ##{tag_change_request.forum_post_id}", forum_topic_path(tag_change_request.forum_topic_id, page: tag_change_request.forum_post.forum_topic_page, anchor: "forum_post_#{tag_change_request.forum_post_id}") %>
|
||||
<% else %>
|
||||
<%= link_to "topic ##{tag_change_request.forum_topic_id}", forum_topic_path(tag_change_request.forum_topic_id) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
6
app/views/tag_change_requests/_votes.html.erb
Normal file
6
app/views/tag_change_requests/_votes.html.erb
Normal file
@ -0,0 +1,6 @@
|
||||
<% if tag_change_request.forum_post&.votes&.any? %>
|
||||
<div style="margin: 1em 0;">
|
||||
<h2>Votes</h2>
|
||||
<%= render "forum_post_votes/list", votes: tag_change_request.forum_post.votes, forum_post: tag_change_request.forum_post, votable: false %>
|
||||
</div>
|
||||
<% end %>
|
@ -5,9 +5,7 @@
|
||||
<ul>
|
||||
<li><strong>From</strong> <%= link_to @tag_implication.antecedent_name, show_or_new_wiki_pages_path(:title => @tag_implication.antecedent_name) %></li>
|
||||
<li><strong>To</strong> <%= link_to @tag_implication.consequent_name, show_or_new_wiki_pages_path(:title => @tag_implication.consequent_name) %></li>
|
||||
<% if @tag_implication.forum_topic_id %>
|
||||
<li><strong>Reference</strong> <%= link_to "topic ##{@tag_implication.forum_topic_id}", forum_topic_path(@tag_implication.forum_topic_id) %></li>
|
||||
<% end %>
|
||||
<%= render "tag_change_requests/reference", tag_change_request: @tag_implication %>
|
||||
<li><strong>Creator</strong> <%= link_to_user @tag_implication.creator %></li>
|
||||
<li><strong>Date</strong> <%= @tag_implication.created_at %></li>
|
||||
<% if @tag_implication.respond_to?(:reason) && @tag_implication.reason.present? %>
|
||||
@ -20,6 +18,8 @@
|
||||
<%= render "tag_relationships/command_buttons", tag_relation: @tag_implication, with_show_link: false %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<%= render "tag_change_requests/votes", tag_change_request: @tag_implication %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user