Skip to content

Commit

Permalink
Module.concat workaround in post renderer is no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
liamwhite committed Mar 4, 2024
1 parent 59d5211 commit 8c9315a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/philomena_web/markdown_renderer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ defmodule PhilomenaWeb.MarkdownRenderer do
alias Philomena.Markdown
alias Philomena.Images.Image
alias Philomena.Repo
alias PhilomenaWeb.ImageView
import Phoenix.HTML
import Phoenix.HTML.Link
import Ecto.Query

@image_view Module.concat(["PhilomenaWeb.ImageView"])

def render_one(item, conn) do
hd(render_collection([item], conn))
end
Expand Down Expand Up @@ -79,28 +78,28 @@ defmodule PhilomenaWeb.MarkdownRenderer do
img != nil ->
case group do
[_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,
image: img,
size: @image_view.select_version(img, :medium),
size: ImageView.select_version(img, :medium),
conn: conn
)
|> safe_to_string()

[_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,
image: img,
size: @image_view.select_version(img, :small),
size: ImageView.select_version(img, :small),
conn: conn
)
|> safe_to_string()

[_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,
image: img,
size: @image_view.select_version(img, :thumb_small),
size: ImageView.select_version(img, :thumb_small),
conn: conn
)
|> safe_to_string()
Expand Down

0 comments on commit 8c9315a

Please sign in to comment.