Merge pull request #4394 from lllusion3469/fav-vote-buttons
Show or hide post vote buttons when (un)favoriting
This commit is contained in:
@@ -4,6 +4,14 @@ $("#score-for-post-<%= @post.id %>").text(<%= @post.score %>);
|
|||||||
$("#favcount-for-post-<%= @post.id %>").text(<%= @post.fav_count %>);
|
$("#favcount-for-post-<%= @post.id %>").text(<%= @post.fav_count %>);
|
||||||
$(".fav-buttons").toggleClass("fav-buttons-false").toggleClass("fav-buttons-true");
|
$(".fav-buttons").toggleClass("fav-buttons-false").toggleClass("fav-buttons-true");
|
||||||
|
|
||||||
|
<% if @post.can_be_voted_by?(CurrentUser.user) %>
|
||||||
|
$("#vote-links-for-post-<%= @post.id %>").show();
|
||||||
|
$("#unvote-link-for-post-<%= @post.id %>").hide();
|
||||||
|
<% else %>
|
||||||
|
$("#vote-links-for-post-<%= @post.id %>").hide();
|
||||||
|
$("#unvote-link-for-post-<%= @post.id %>").show();
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if policy(@post).can_view_favlist? %>
|
<% if policy(@post).can_view_favlist? %>
|
||||||
var fav_count = <%= @post.fav_count %>;
|
var fav_count = <%= @post.fav_count %>;
|
||||||
$("#favlist").html("<%= j post_favlist(@post) %>");
|
$("#favlist").html("<%= j post_favlist(@post) %>");
|
||||||
|
|||||||
Reference in New Issue
Block a user