diff --git a/lib/philomena_web/templates/search/index.html.slime b/lib/philomena_web/templates/search/index.html.slime index 878d24861..2c4cffe98 100644 --- a/lib/philomena_web/templates/search/index.html.slime +++ b/lib/philomena_web/templates/search/index.html.slime @@ -1,5 +1,5 @@ = cond do - - Enum.any?(@images) or Enum.any?(@tags, &Enum.any?(elem(&1, 0).dnp_entries)) -> + - Enum.any?(@images) or override_display(@tags) -> = render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Searching for #{@conn.params["q"]}", route: fn p -> Routes.search_path(@conn, :index, p) end, scope: scope(@conn) - assigns[:error] -> diff --git a/lib/philomena_web/views/search_view.ex b/lib/philomena_web/views/search_view.ex index 8500d4d83..d03b689c3 100644 --- a/lib/philomena_web/views/search_view.ex +++ b/lib/philomena_web/views/search_view.ex @@ -3,4 +3,10 @@ defmodule PhilomenaWeb.SearchView do def scope(conn), do: PhilomenaWeb.ImageScope.scope(conn) def hides_images?(conn), do: can?(conn, :hide, %Philomena.Images.Image{}) + + def override_display([{_tag, _description, dnp_entries}]) do + Enum.any?(dnp_entries) + end + + def override_display(_), do: false end