From f77d305f83720b2b45b0977ab2f878d3b4126f56 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 4 Aug 2019 18:58:25 -0500 Subject: [PATCH] Fix #3250: Show unvote link as applicable upon page load. --- app/views/posts/partials/show/_information.html.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb index 50ae5f40e..53a30bfda 100644 --- a/app/views/posts/partials/show/_information.html.erb +++ b/app/views/posts/partials/show/_information.html.erb @@ -18,7 +18,18 @@
  • Source: <%= post_source_tag(post) %>
  • Rating: <%= post.pretty_rating %>
  • -
  • Score: <%= post.score %> <% if CurrentUser.is_voter? %>(vote <%= link_to content_tag("i", nil, class: "far fa-thumbs-up"), post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %> <%= link_to content_tag("i", nil, class: "far fa-thumbs-down"), post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %><%= link_to "undo vote", post_votes_path(post), :remote => true, :method => :delete, :id => "unvote-link-for-post-#{post.id}", :class => "unvote-post-link", :style => "display: none;" %>)<% end %>
  • +
  • Score: <%= post.score %> + <% if CurrentUser.is_voter? %> + <%= tag.span id: "vote-links-for-post-#{post.id}", style: ("display: none;" if !@post.can_be_voted_by?(CurrentUser.user)) do %> + (vote + <%= link_to tag.i(class: "far fa-thumbs-up"), post_votes_path(post_id: post.id, score: "up"), remote: true, method: :post %> + <%= link_to tag.i(class: "far fa-thumbs-down"), post_votes_path(post_id: post.id, score: "down"), remote: true, method: :post %>) + <% end %> + <%= tag.span id: "unvote-link-for-post-#{post.id}", style: ("display: none;" if @post.can_be_voted_by?(CurrentUser.user)) do %> + (<%= link_to "undo vote", post_votes_path(post), remote: true, method: :delete, class: "unvote-post-link" %>) + <% end %> + <% end %> +
  • Favorites: <%= post.fav_count %> <% if CurrentUser.is_gold? %> <%= link_to "Show ยป", "#", id: "show-favlist-link", style: ("display: none;" if post.fav_count == 0) %>