add toggle for testing cropped thumbnails

This commit is contained in:
r888888888
2017-09-06 17:02:43 -07:00
parent 599f2a59fe
commit 63f7edd0c6
4 changed files with 8 additions and 3 deletions

View File

@@ -101,13 +101,13 @@
margin: 0 auto; margin: 0 auto;
} }
img { img {
object-fit: cover; object-fit: contain;
width: 48.5vw; width: 48.5vw;
height: 48.5vw; height: 48.5vw;
margin: 0 auto; margin: 0 auto;
border: none; border: none;
} }
img.cropped { img.cropped-true {
object-fit: cover; object-fit: cover;
} }
&[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=mp4]:before, &[data-file-ext=zip]:before { &[data-tags~=animated]:before, &[data-file-ext=swf]:before, &[data-file-ext=webm]:before, &[data-file-ext=mp4]:before, &[data-file-ext=zip]:before {

View File

@@ -257,6 +257,10 @@ class AnonymousUser
false false
end end
def cropped_thumbnails?
false
end
User::Roles.reject {|r| r == :anonymous}.each do |name| User::Roles.reject {|r| r == :anonymous}.each do |name|
define_method("is_#{name}?") do define_method("is_#{name}?") do
false false

View File

@@ -45,6 +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
) )
include Danbooru::HasBitFlags include Danbooru::HasBitFlags

View File

@@ -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 itemprop="thumbnailUrl" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">} html << %{<img class="cropped-#{CurrentUser.cropped_thumbnails?}" itemprop="thumbnailUrl" src="#{post.preview_file_url}" alt="#{h(post.tag_string)}">}
html << %{</a>} html << %{</a>}
if options[:pool] if options[:pool]