Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
liamwhite committed Apr 8, 2024
2 parents 3baae3b + 3ffebd1 commit 0da05e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/philomena_web/templates/search/index.html.slime
Original file line number Diff line number Diff line change
@@ -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] ->
Expand Down
6 changes: 6 additions & 0 deletions lib/philomena_web/views/search_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0da05e3

Please sign in to comment.