philomena/lib/philomena/image_scope.ex
2020-01-10 23:20:19 -05:00

18 lines
390 B
Elixir

defmodule Philomena.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