From c76f28dc0b3d5368b7cca4cd9659c03fce634960 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 23 Dec 2019 09:50:39 -0500 Subject: [PATCH] add tags to image target --- .../templates/image/_image_target.html.slime | 2 +- lib/philomena_web/views/image_view.ex | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/philomena_web/templates/image/_image_target.html.slime b/lib/philomena_web/templates/image/_image_target.html.slime index bbe5b338..94cacced 100644 --- a/lib/philomena_web/templates/image/_image_target.html.slime +++ b/lib/philomena_web/templates/image/_image_target.html.slime @@ -18,7 +18,7 @@ picture - else .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 - thumb_url = thumb_url(@image, can?(@conn, :show, @image), size) diff --git a/lib/philomena_web/views/image_view.ex b/lib/philomena_web/views/image_view.ex index 9cca6d7e..0992ada5 100644 --- a/lib/philomena_web/views/image_view.ex +++ b/lib/philomena_web/views/image_view.ex @@ -6,14 +6,19 @@ defmodule PhilomenaWeb.ImageView do def show_vote_counts?(%{hide_vote_counts: true}), do: false 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, image, size) do uris = thumb_urls(image, can?(conn, :show, image)) vid? = image.image_mime_type == "video/webm" gif? = image.image_mime_type == "image/gif" - tags = Tag.display_order(image.tags) |> Enum.map_join(", ", & &1.name) - alt = "Size: #{image.image_width}x#{image.image_height} | Tagged: #{tags}" + alt = title_text(image) hidpi? = conn.cookies["hidpi"] == "true" webm? = conn.cookies["webm"] == "true"