From ad849e8bb82b121b5db7b964125ffa9748005dca Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 19 Dec 2019 20:22:39 -0500 Subject: [PATCH] readd ignored tag list --- lib/philomena_web/controllers/tag_controller.ex | 4 +--- lib/philomena_web/templates/tag/show.html.slime | 4 ++-- lib/philomena_web/views/layout_view.ex | 7 ++++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/philomena_web/controllers/tag_controller.ex b/lib/philomena_web/controllers/tag_controller.ex index b5fe748f..086bc0e1 100644 --- a/lib/philomena_web/controllers/tag_controller.ex +++ b/lib/philomena_web/controllers/tag_controller.ex @@ -59,10 +59,8 @@ defmodule PhilomenaWeb.TagController do render( conn, "show.html", - tag: tag, - body: body, + tags: [{tag, body, dnp_entries}], search_query: search_query, - dnp_entries: dnp_entries, interactions: interactions, images: images, layout_class: "layout--wide", diff --git a/lib/philomena_web/templates/tag/show.html.slime b/lib/philomena_web/templates/tag/show.html.slime index 1513610e..1cf1cdfa 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, @body, @dnp_entries}], images: @images, header: "Images tagged #{@tag.name}", scope: [q: @search_query], route: fn p -> Routes.tag_path(@conn, :show, @tag, p) end += render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Images tagged #{@tag.name}", scope: [q: @search_query], route: fn p -> Routes.tag_path(@conn, :show, @tag, p) end -= render PhilomenaWeb.SearchView, "_form.html", conn: @conn \ No newline at end of file += render PhilomenaWeb.SearchView, "_form.html", conn: @conn diff --git a/lib/philomena_web/views/layout_view.ex b/lib/philomena_web/views/layout_view.ex index e0857e9f..e9107e40 100644 --- a/lib/philomena_web/views/layout_view.ex +++ b/lib/philomena_web/views/layout_view.ex @@ -22,6 +22,11 @@ defmodule PhilomenaWeb.LayoutView do host |> to_string end + defp ignored_tag_list(nil), do: [] + defp ignored_tag_list([]), do: [] + defp ignored_tag_list([{tag, _body, _dnp_entries}]), do: [tag.id] + defp ignored_tag_list(tags), do: Enum.map(tags, & &1.id) + def clientside_data(conn) do extra = Map.get(conn.assigns, :clientside_data, []) interactions = Map.get(conn.assigns, :interactions, []) @@ -44,7 +49,7 @@ defmodule PhilomenaWeb.LayoutView do fancy_tag_edit: if(user, do: user.fancy_tag_field_on_edit, else: true), fancy_tag_upload: if(user, do: user.fancy_tag_field_on_upload, else: true), interactions: Jason.encode!(interactions), - ignored_tag_list: "[]" + ignored_tag_list: Jason.encode!(ignored_tag_list(conn.assigns[:tags])) ] data = Keyword.merge(data, extra)