posts: add "view original" sidebar option.
* Add a "View original" sidebar option. * Rename the "View large" sidebar option to "View smaller". * Remove the "Loading..." message when switching image sizes. * Fix the V hotkey not working after using it once. * Change #image-resize-link to .image-view-original link (note that there are two of these links now, one in the notice bar and one in the sidebar). * Add a `data-post-current-image-size` attribute on the <body> element and use it to control visibility of links and notices.
This commit is contained in:
@@ -269,6 +269,11 @@ class Post < ApplicationRecord
|
||||
def resize_percentage
|
||||
100 * large_image_width.to_f / image_width.to_f
|
||||
end
|
||||
|
||||
# XXX
|
||||
def current_image_size
|
||||
has_large? && CurrentUser.default_image_size == "large" ? "large" : "original"
|
||||
end
|
||||
end
|
||||
|
||||
module ApprovalMethods
|
||||
@@ -1764,6 +1769,10 @@ class Post < ApplicationRecord
|
||||
save
|
||||
end
|
||||
|
||||
def html_data_attributes
|
||||
super + [:has_large?, :current_image_size]
|
||||
end
|
||||
|
||||
def self.available_includes
|
||||
[:uploader, :updater, :approver, :parent, :upload, :artist_commentary, :flags, :appeals, :notes, :comments, :children, :approvals, :replacements, :pixiv_ugoira_frame_data]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user