philomena/lib/philomena_web/image_scope.ex

18 lines
393 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, "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