post previews: fix css for captioned post previews.

Captioned post previews (previews with the pool name, similarity, or
size beneath) need to have `height: auto` set, otherwise they'll default
to `height: 154px` (just enough for the image) and the caption won't be visible.
This commit is contained in:
evazion
2018-09-06 20:04:48 -05:00
parent 950fcdb7b2
commit 22c27f8910
2 changed files with 7 additions and 18 deletions

View File

@@ -13,12 +13,14 @@ article.post-preview {
@include inline-block; @include inline-block;
} }
&.pooled { &.captioned {
height: 214px; height: auto;
vertical-align: text-top;
} }
.desc { .desc {
font-size: 80%; font-size: 80%;
margin-bottom: 0;
} }
img { img {
@@ -34,19 +36,6 @@ article.post-preview {
} }
} }
#iqdb-similar {
overflow: hidden;
.post-preview {
height: auto;
margin-bottom: 0;
}
p {
margin-bottom: 0;
}
}
#saved-searches-nav { #saved-searches-nav {
margin-top: 1em; margin-top: 1em;
} }

View File

@@ -27,7 +27,7 @@ class PostPresenter < Presenter
cropped_src = post.preview_file_url cropped_src = post.preview_file_url
end end
html = %{<article itemscope itemtype="http://schema.org/ImageObject" id="post_#{post.id}" class="#{preview_class(post, options[:pool], options)}" #{data_attributes(post)}>} html = %{<article itemscope itemtype="http://schema.org/ImageObject" id="post_#{post.id}" class="#{preview_class(post, options)}" #{data_attributes(post)}>}
if options[:tags].present? && !CurrentUser.is_anonymous? if options[:tags].present? && !CurrentUser.is_anonymous?
tag_param = "?tags=#{CGI::escape(options[:tags])}" tag_param = "?tags=#{CGI::escape(options[:tags])}"
elsif options[:pool_id] || options[:pool] elsif options[:pool_id] || options[:pool]
@@ -72,10 +72,10 @@ class PostPresenter < Presenter
html.html_safe html.html_safe
end end
def self.preview_class(post, description = nil, options = {}) def self.preview_class(post, options = {})
klass = "post-preview" klass = "post-preview"
# klass << " large-cropped" if post.has_cropped? && options[:show_cropped] # klass << " large-cropped" if post.has_cropped? && options[:show_cropped]
klass << " pooled" if description klass << " captioned" if options.values_at(:pooled, :size, :similarity).any?(&:present?)
klass << " post-status-pending" if post.is_pending? klass << " post-status-pending" if post.is_pending?
klass << " post-status-flagged" if post.is_flagged? klass << " post-status-flagged" if post.is_flagged?
klass << " post-status-deleted" if post.is_deleted? klass << " post-status-deleted" if post.is_deleted?