Module.concat workaround in post renderer is no longer needed

This commit is contained in:
Liam 2024-03-04 11:34:02 -05:00
parent 59d5211926
commit 8c9315acf2

View file

@ -2,12 +2,11 @@ defmodule PhilomenaWeb.MarkdownRenderer do
alias Philomena.Markdown alias Philomena.Markdown
alias Philomena.Images.Image alias Philomena.Images.Image
alias Philomena.Repo alias Philomena.Repo
alias PhilomenaWeb.ImageView
import Phoenix.HTML import Phoenix.HTML
import Phoenix.HTML.Link import Phoenix.HTML.Link
import Ecto.Query import Ecto.Query
@image_view Module.concat(["PhilomenaWeb.ImageView"])
def render_one(item, conn) do def render_one(item, conn) do
hd(render_collection([item], conn)) hd(render_collection([item], conn))
end end
@ -79,28 +78,28 @@ defmodule PhilomenaWeb.MarkdownRenderer do
img != nil -> img != nil ->
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(ImageView, "_image_target.html",
embed_display: true, embed_display: true,
image: img, image: img,
size: @image_view.select_version(img, :medium), size: ImageView.select_version(img, :medium),
conn: conn conn: conn
) )
|> safe_to_string() |> safe_to_string()
[_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(ImageView, "_image_target.html",
embed_display: true, embed_display: true,
image: img, image: img,
size: @image_view.select_version(img, :small), size: ImageView.select_version(img, :small),
conn: conn conn: conn
) )
|> safe_to_string() |> safe_to_string()
[_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(ImageView, "_image_target.html",
embed_display: true, embed_display: true,
image: img, image: img,
size: @image_view.select_version(img, :thumb_small), size: ImageView.select_version(img, :thumb_small),
conn: conn conn: conn
) )
|> safe_to_string() |> safe_to_string()