From 22c27f8910e26e34b7855bcdd470e6c4154747db Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 6 Sep 2018 20:04:48 -0500 Subject: [PATCH] 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. --- app/javascript/src/styles/specific/posts.scss | 19 ++++--------------- app/presenters/post_presenter.rb | 6 +++--- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/app/javascript/src/styles/specific/posts.scss b/app/javascript/src/styles/specific/posts.scss index 19ded8736..e82b222ba 100644 --- a/app/javascript/src/styles/specific/posts.scss +++ b/app/javascript/src/styles/specific/posts.scss @@ -13,12 +13,14 @@ article.post-preview { @include inline-block; } - &.pooled { - height: 214px; + &.captioned { + height: auto; + vertical-align: text-top; } .desc { font-size: 80%; + margin-bottom: 0; } 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 { margin-top: 1em; } diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index 7961829ce..9bfb8b8b8 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -27,7 +27,7 @@ class PostPresenter < Presenter cropped_src = post.preview_file_url end - html = %{
} + html = %{
} if options[:tags].present? && !CurrentUser.is_anonymous? tag_param = "?tags=#{CGI::escape(options[:tags])}" elsif options[:pool_id] || options[:pool] @@ -72,10 +72,10 @@ class PostPresenter < Presenter html.html_safe end - def self.preview_class(post, description = nil, options = {}) + def self.preview_class(post, options = {}) klass = "post-preview" # 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-flagged" if post.is_flagged? klass << " post-status-deleted" if post.is_deleted?