Fix markdown embed displays for small images

This commit is contained in:
byte[] 2023-04-10 21:33:44 -04:00
parent 3366182557
commit 5e908e40f6
3 changed files with 6 additions and 2 deletions

View file

@ -80,6 +80,7 @@ defmodule PhilomenaWeb.MarkdownRenderer do
case group do case group do
[_id, "p"] when not img.hidden_from_users and img.approved -> [_id, "p"] when not img.hidden_from_users and img.approved ->
Phoenix.View.render(@image_view, "_image_target.html", Phoenix.View.render(@image_view, "_image_target.html",
embed_display: true,
image: img, image: img,
size: @image_view.select_version(img, :medium), size: @image_view.select_version(img, :medium),
conn: conn conn: conn
@ -88,6 +89,7 @@ defmodule PhilomenaWeb.MarkdownRenderer do
[_id, "t"] when not img.hidden_from_users and img.approved -> [_id, "t"] when not img.hidden_from_users and img.approved ->
Phoenix.View.render(@image_view, "_image_target.html", Phoenix.View.render(@image_view, "_image_target.html",
embed_display: true,
image: img, image: img,
size: @image_view.select_version(img, :small), size: @image_view.select_version(img, :small),
conn: conn conn: conn
@ -96,6 +98,7 @@ defmodule PhilomenaWeb.MarkdownRenderer do
[_id, "s"] when not img.hidden_from_users and img.approved -> [_id, "s"] when not img.hidden_from_users and img.approved ->
Phoenix.View.render(@image_view, "_image_target.html", Phoenix.View.render(@image_view, "_image_target.html",
embed_display: true,
image: img, image: img,
size: @image_view.select_version(img, :thumb_small), size: @image_view.select_version(img, :thumb_small),
conn: conn conn: conn

View file

@ -1,6 +1,6 @@
.center--layout--flex .center--layout--flex
= if @image.thumbnails_generated do = if @image.thumbnails_generated do
= render PhilomenaWeb.ImageView, "_image_target.html", image: @image, conn: @conn = render PhilomenaWeb.ImageView, "_image_target.html", embed_display: false, image: @image, conn: @conn
- else - else
#thumbnails-not-yet-generated.block.block--fixed.block--warning.layout--narrow #thumbnails-not-yet-generated.block.block--fixed.block--warning.layout--narrow
h3 Just a moment h3 Just a moment

View file

@ -1,4 +1,5 @@
- size = assigns[:size] || :full - size = assigns[:size] || :full
- embed_display = assigns[:embed_display] || false
= content_tag :div, [data: image_container_data(@conn, @image, size), class: "image-show-container"] do = content_tag :div, [data: image_container_data(@conn, @image, size), class: "image-show-container"] do
.block.block--fixed.block--warning.block--no-margin.image-filtered.hidden .block.block--fixed.block--warning.block--no-margin.image-filtered.hidden
@ -10,7 +11,7 @@
=< link("your current filter", to: Routes.filter_path(@conn, :show, @conn.assigns.current_filter), class: "filter-link") =< link("your current filter", to: Routes.filter_path(@conn, :show, @conn.assigns.current_filter), class: "filter-link")
' . ' .
= if size == :full do = if size == :full and not embed_display do
.image-target.hidden.image-show data-scaled=scaled_value(@conn.assigns.current_user) data-uris=Jason.encode!(thumb_urls(@image, can?(@conn, :hide, @image))) data-width=@image.image_width data-height=@image.image_height data-image-size=@image.image_size data-mime-type=@image.image_mime_type .image-target.hidden.image-show data-scaled=scaled_value(@conn.assigns.current_user) data-uris=Jason.encode!(thumb_urls(@image, can?(@conn, :hide, @image))) data-width=@image.image_width data-height=@image.image_height data-image-size=@image.image_size data-mime-type=@image.image_mime_type
= if @image.image_mime_type == "video/webm" do = if @image.image_mime_type == "video/webm" do
video controls=true video controls=true