add fallback for older previews

This commit is contained in:
Albert Yi
2018-07-18 12:53:35 -07:00
parent 0fe0d23a62
commit 76342582b2
2 changed files with 7 additions and 2 deletions

View File

@@ -181,7 +181,12 @@
img {
width: 100%;
height: 33.3vw
height: 33.3vw;
&.has-cropped-false {
width: 33.3vw;
object-fit: cover;
}
}
}

View File

@@ -43,7 +43,7 @@ class PostPresenter < Presenter
html << %{<picture>}
html << %{<source media="(max-width: 660px)" srcset="#{cropped_src}">}
html << %{<source media="(min-width: 660px)" srcset="#{post.preview_file_url}">}
html << %{<img itemprop="thumbnailUrl" src="#{post.preview_file_url}" title="#{h(tooltip)}" alt="#{h(post.tag_string)}">}
html << %{<img itemprop="thumbnailUrl" class="has-cropped-#{post.has_cropped?}" src="#{post.preview_file_url}" title="#{h(tooltip)}" alt="#{h(post.tag_string)}">}
html << %{</picture>}
html << %{</a>}