mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
add tags to image target
This commit is contained in:
parent
44a59aa67b
commit
c76f28dc0b
2 changed files with 9 additions and 4 deletions
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue