diff --git a/lib/philomena_web/image_loader.ex b/lib/philomena_web/image_loader.ex index acf1c34f..6bfa53db 100644 --- a/lib/philomena_web/image_loader.ex +++ b/lib/philomena_web/image_loader.ex @@ -45,7 +45,7 @@ defmodule PhilomenaWeb.ImageLoader do body |> search_tag_names() |> load_tags() - |> render_dnp_entries(conn) + |> render_bodies(conn) {records, tags} end @@ -82,15 +82,18 @@ defmodule PhilomenaWeb.ImageLoader do |> Repo.all() end - defp render_dnp_entries([], _conn), do: [] - defp render_dnp_entries([tag], conn) do + defp render_bodies([], _conn), do: [] + defp render_bodies([tag], conn) do dnp_bodies = Renderer.render_collection(Enum.map(tag.dnp_entries, &%{body: &1.conditions || ""}), conn) dnp_entries = Enum.zip(dnp_bodies, tag.dnp_entries) - [{tag, dnp_entries}] + description = + Renderer.render_one(%{body: tag.description || ""}) + + [{tag, description, dnp_entries}] end - defp render_dnp_entries(tags, _conn), do: tags + defp render_bodies(tags, _conn), do: tags end \ No newline at end of file diff --git a/lib/philomena_web/templates/tag/show.html.slime b/lib/philomena_web/templates/tag/show.html.slime index 8fa78b65..420575ba 100644 --- a/lib/philomena_web/templates/tag/show.html.slime +++ b/lib/philomena_web/templates/tag/show.html.slime @@ -1,3 +1,3 @@ -= render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: [{@tag, @dnp_entries}], images: @images, scope: [q: @search_query] += render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: [{@tag, @body, @dnp_entries}], images: @images, scope: [q: @search_query] = render PhilomenaWeb.SearchView, "_form.html", conn: @conn \ No newline at end of file diff --git a/lib/philomena_web/views/image_view.ex b/lib/philomena_web/views/image_view.ex index 528e3961..dc2595d8 100644 --- a/lib/philomena_web/views/image_view.ex +++ b/lib/philomena_web/views/image_view.ex @@ -137,8 +137,8 @@ defmodule PhilomenaWeb.ImageView do end def info_row(_conn, []), do: [] - def info_row(conn, [{tag, dnp_entries}]) do - render PhilomenaWeb.TagView, "_tag_info_row.html", conn: conn, tag: tag, dnp_entries: dnp_entries + def info_row(conn, [{tag, description, dnp_entries}]) do + render PhilomenaWeb.TagView, "_tag_info_row.html", conn: conn, tag: tag, body: description, dnp_entries: dnp_entries end def info_row(conn, tags) do render PhilomenaWeb.TagView, "_tags_row.html", conn: conn, tags: tags