philomena/lib/philomena_web/image_scope.ex
liamwhite d1c893248d
Search navigation (#14)
* return hits from elasticsearch and add in sort param to templates

* use returned hits from elasticsearch for navigation

* mix format

* fix gallery pagination

* add missing fields to search help dropdown

* unused variable
2020-08-13 11:32:35 -04:00

19 lines
427 B
Elixir

defmodule PhilomenaWeb.ImageScope do
def scope(conn) do
[]
|> scope(conn, "q", :q)
|> scope(conn, "sf", :sf)
|> scope(conn, "sd", :sd)
|> scope(conn, "del", :del)
|> scope(conn, "sort", :sort)
|> scope(conn, "hidden", :hidden)
end
defp scope(list, conn, key, key_atom) do
case conn.params[key] do
nil -> list
"" -> list
val -> [{key_atom, val} | list]
end
end
end