add tags to image target

This commit is contained in:
byte[] 2019-12-23 09:50:39 -05:00
parent 44a59aa67b
commit c76f28dc0b
2 changed files with 9 additions and 4 deletions

View file

@ -18,7 +18,7 @@
picture picture
- else - else
.image-show.hidden .image-show.hidden
a href=Routes.image_path(@conn, :show, @image) a href=Routes.image_path(@conn, :show, @image) title=title_text(@image)
span.imgspoiler span.imgspoiler
- thumb_url = thumb_url(@image, can?(@conn, :show, @image), size) - thumb_url = thumb_url(@image, can?(@conn, :show, @image), size)

View file

@ -6,14 +6,19 @@ defmodule PhilomenaWeb.ImageView do
def show_vote_counts?(%{hide_vote_counts: true}), do: false def show_vote_counts?(%{hide_vote_counts: true}), do: false
def show_vote_counts?(_user), do: true def show_vote_counts?(_user), do: true
# this is a bit ridculous def title_text(image) do
tags = Tag.display_order(image.tags) |> Enum.map_join(", ", & &1.name)
"Size: #{image.image_width}x#{image.image_height} | Tagged: #{tags}"
end
# this is a bit ridiculous
def render_intent(_conn, %{thumbnails_generated: false}, _size), do: :not_rendered def render_intent(_conn, %{thumbnails_generated: false}, _size), do: :not_rendered
def render_intent(conn, image, size) do def render_intent(conn, image, size) do
uris = thumb_urls(image, can?(conn, :show, image)) uris = thumb_urls(image, can?(conn, :show, image))
vid? = image.image_mime_type == "video/webm" vid? = image.image_mime_type == "video/webm"
gif? = image.image_mime_type == "image/gif" gif? = image.image_mime_type == "image/gif"
tags = Tag.display_order(image.tags) |> Enum.map_join(", ", & &1.name) alt = title_text(image)
alt = "Size: #{image.image_width}x#{image.image_height} | Tagged: #{tags}"
hidpi? = conn.cookies["hidpi"] == "true" hidpi? = conn.cookies["hidpi"] == "true"
webm? = conn.cookies["webm"] == "true" webm? = conn.cookies["webm"] == "true"