Make "show scores" setting persistent. The setting is stored in a `post_preview_show_votes` cookie. This means it's remembered on a per-device basis, but not on a per-account basis. This is so users without an account can use the setting, and so you can use different settings on desktop and mobile. The `view=score` URL param has been replaced by `show_votes=true`. The `show_votes` URL param overrides the `post_preview_show_votes` cookie.
14 lines
593 B
Plaintext
14 lines
593 B
Plaintext
<% if @post.valid? %>
|
|
var $post = $("#post_<%= @post.id %>");
|
|
var $new_post = $("<%= j post_preview(@post, fit: :compact, show_deleted: true, show_votes: @show_votes, size: @preview_size) %>");
|
|
Danbooru.Blacklist.apply_post($new_post.get(0));
|
|
$("#post_<%= @post.id %>").replaceWith($new_post);
|
|
<% if params[:mode] == "quick-edit" %>
|
|
Danbooru.PostModeMenu.close_edit_form();
|
|
<% end %>
|
|
<% else %>
|
|
Danbooru.error(`Post #<%= @post.id %>: <%= j @post.errors.full_messages.join("; ") %>`);
|
|
<% end %>
|
|
|
|
$(document).trigger("danbooru:post-preview-updated", <%= raw @post.to_json %>);
|