fixes #3287
This commit is contained in:
@@ -257,7 +257,7 @@ class AnonymousUser
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def cropped_thumbnails?
|
def disable_cropped_thumbnails?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
attr_accessible :source, :rating, :tag_string, :old_tag_string, :old_parent_id, :old_source, :old_rating, :parent_id, :has_embedded_notes, :as => [:member, :builder, :gold, :platinum, :moderator, :admin, :default]
|
attr_accessible :source, :rating, :tag_string, :old_tag_string, :old_parent_id, :old_source, :old_rating, :parent_id, :has_embedded_notes, :as => [:member, :builder, :gold, :platinum, :moderator, :admin, :default]
|
||||||
attr_accessible :is_rating_locked, :is_note_locked, :as => [:builder, :moderator, :admin]
|
attr_accessible :is_rating_locked, :is_note_locked, :has_cropped, :as => [:builder, :moderator, :admin]
|
||||||
attr_accessible :is_status_locked, :as => [:admin]
|
attr_accessible :is_status_locked, :as => [:admin]
|
||||||
attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :view_count
|
attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :view_count
|
||||||
|
|
||||||
@@ -171,7 +171,11 @@ class Post < ApplicationRecord
|
|||||||
return "/images/download-preview.png"
|
return "/images/download-preview.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
"/data/preview/#{file_path_prefix}#{md5}.jpg"
|
if has_cropped? && !CurrentUser.disable_cropped_thumbnails?
|
||||||
|
"https://s3.amazonaws.com/#{Danbooru.config.aws_s3_bucket_name}/cropped/small/#{md5}.jpg"
|
||||||
|
else
|
||||||
|
"/data/preview/#{file_path_prefix}#{md5}.jpg"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def complete_preview_file_url
|
def complete_preview_file_url
|
||||||
@@ -1767,6 +1771,7 @@ class Post < ApplicationRecord
|
|||||||
|
|
||||||
BOOLEAN_ATTRIBUTES = %w(
|
BOOLEAN_ATTRIBUTES = %w(
|
||||||
has_embedded_notes
|
has_embedded_notes
|
||||||
|
has_cropped
|
||||||
)
|
)
|
||||||
has_bit_flags BOOLEAN_ATTRIBUTES
|
has_bit_flags BOOLEAN_ATTRIBUTES
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class User < ApplicationRecord
|
|||||||
is_super_voter
|
is_super_voter
|
||||||
disable_tagged_filenames
|
disable_tagged_filenames
|
||||||
enable_recent_searches
|
enable_recent_searches
|
||||||
cropped_thumbnails
|
disable_cropped_thumbnails
|
||||||
)
|
)
|
||||||
|
|
||||||
include Danbooru::HasBitFlags
|
include Danbooru::HasBitFlags
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class PostPresenter < Presenter
|
|||||||
tag_param = nil
|
tag_param = nil
|
||||||
end
|
end
|
||||||
html << %{<a href="#{path}/#{post.id}#{tag_param}">}
|
html << %{<a href="#{path}/#{post.id}#{tag_param}">}
|
||||||
html << %{<img class="cropped-#{CurrentUser.cropped_thumbnails?}" itemprop="thumbnailUrl" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
|
html << %{<img itemprop="thumbnailUrl" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
|
||||||
html << %{</a>}
|
html << %{</a>}
|
||||||
|
|
||||||
if options[:pool]
|
if options[:pool]
|
||||||
|
|||||||
@@ -74,6 +74,8 @@
|
|||||||
|
|
||||||
<%= f.input :disable_tagged_filenames, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
<%= f.input :disable_tagged_filenames, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
||||||
|
|
||||||
|
<%= f.input :disable_cropped_thumbnails, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
||||||
|
|
||||||
<%= f.input :enable_recent_searches, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
<%= f.input :enable_recent_searches, :as => :select, :collection => [["No", "false"], ["Yes", "true"]], :include_blank => false %>
|
||||||
|
|
||||||
<%= f.input :favorite_tags, :label => "Frequent tags", :hint => "A list of tags that you use often. They will appear when using the list of Related Tags.", :input_html => { :rows => 5, :data => { :autocomplete => "tag-query" } } %>
|
<%= f.input :favorite_tags, :label => "Frequent tags", :hint => "A list of tags that you use often. They will appear when using the list of Related Tags.", :input_html => { :rows => 5, :data => { :autocomplete => "tag-query" } } %>
|
||||||
|
|||||||
Reference in New Issue
Block a user