mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-02-17 11:04:22 +01:00
nicer search error message
This commit is contained in:
parent
4cfaf47573
commit
b18e17a179
2 changed files with 12 additions and 2 deletions
|
@ -24,10 +24,11 @@ defmodule PhilomenaWeb.SearchController do
|
||||||
conn
|
conn
|
||||||
|> render("index.html", images: images, search_query: params["q"])
|
|> render("index.html", images: images, search_query: params["q"])
|
||||||
else
|
else
|
||||||
{:error, _msg} ->
|
{:error, msg} ->
|
||||||
conn
|
conn
|
||||||
|> render("index.html",
|
|> render("index.html",
|
||||||
images: [],
|
images: [],
|
||||||
|
error: msg,
|
||||||
search_query: params["q"]
|
search_query: params["q"]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1 +1,10 @@
|
||||||
|
= cond do
|
||||||
|
- Enum.any?(@images) ->
|
||||||
= render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @images, route: fn p -> Routes.search_path(@conn, :index, p) end, params: [q: @search_query]
|
= render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @images, route: fn p -> Routes.search_path(@conn, :index, p) end, params: [q: @search_query]
|
||||||
|
- assigns[:error] ->
|
||||||
|
p
|
||||||
|
' Oops, there was an error evaluating your query:
|
||||||
|
pre = assigns[:error]
|
||||||
|
- true ->
|
||||||
|
p
|
||||||
|
' No images found!
|
Loading…
Reference in a new issue