fixes #1596
This commit is contained in:
@@ -170,6 +170,10 @@
|
||||
Danbooru.Post.initialize_favlist = function() {
|
||||
$("#favlist").hide();
|
||||
$("#hide-favlist-link").hide();
|
||||
var fav_count = $("#show-favlist-link").prev().text();
|
||||
if (fav_count === "0") {
|
||||
$("#show-favlist-link").hide();
|
||||
}
|
||||
|
||||
$("#show-favlist-link").click(function(e) {
|
||||
$("#favlist").show();
|
||||
|
||||
@@ -5,5 +5,11 @@
|
||||
$("a#remove-from-favorites").show();
|
||||
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
|
||||
$("#favcount-for-post-<%= @post.id %>").html(<%= @post.fav_count %>);
|
||||
<% if CurrentUser.is_gold? %>
|
||||
$("#favlist").html("<%= escape_javascript(post_favlist(@post)) %>");
|
||||
if (!$("#favlist").is(":visible")) {
|
||||
$("#show-favlist-link").show();
|
||||
}
|
||||
<% end %>
|
||||
Danbooru.notice("You have favorited this post");
|
||||
<% end %>
|
||||
|
||||
@@ -2,4 +2,10 @@ $("a#add-to-favorites").show();
|
||||
$("a#remove-from-favorites").hide();
|
||||
$("#score-for-post-<%= @post.id %>").html(<%= @post.score %>);
|
||||
$("#favcount-for-post-<%= @post.id %>").html(<%= @post.fav_count %>);
|
||||
<% if CurrentUser.is_gold? %>
|
||||
$("#favlist").html("<%= escape_javascript(post_favlist(@post)) %>");
|
||||
<% if @post.fav_count == 0 %>
|
||||
$("#show-favlist-link, #hide-favlist-link, #favlist").hide();
|
||||
<% end %>
|
||||
<% end %>
|
||||
Danbooru.notice("You have unfavorited this post");
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<li>Rating: <%= post.pretty_rating %></li>
|
||||
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> <% if CurrentUser.is_gold? %>(vote <%= link_to "up", post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %>/<%= link_to "down", post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %>)<% end %></li>
|
||||
<li>Favorites: <span id="favcount-for-post-<%= post.id %>"><%= post.fav_count %></span>
|
||||
<% if CurrentUser.is_gold? && post.fav_count > 0 %>
|
||||
<% if CurrentUser.is_gold? %>
|
||||
<%= link_to "»".html_safe, "#", :id => "show-favlist-link" %>
|
||||
<%= link_to "«".html_safe, "#", :id => "hide-favlist-link" %>
|
||||
<div id="favlist"><%= post_favlist(post) %></div>
|
||||
|
||||
Reference in New Issue
Block a user