$("#add-to-favorites, #add-fav-button, #remove-from-favorites, #remove-fav-button").toggle(); $("#remove-fav-button").addClass("animate"); $("span.post-votes[data-id=<%= @post.id %>]").replaceWith("<%= j render_post_votes @post, current_user: CurrentUser.user %>"); $("#favcount-for-post-<%= @post.id %>").text(<%= @post.fav_count %>); $(".fav-buttons").toggleClass("fav-buttons-false").toggleClass("fav-buttons-true"); <% if policy(@post).can_view_favlist? %> var fav_count = <%= @post.fav_count %>; $("#favlist").html("<%= j render "posts/partials/show/favorite_list", post: @post %>"); if (fav_count === 0) { $("#show-favlist-link, #hide-favlist-link, #favlist").hide(); } else if (!$("#favlist").is(":visible")) { $("#show-favlist-link").show(); } <% end %> Danbooru.Utility.notice("<%= j flash[:notice] %>");