mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-23 20:18:00 +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
|
||||
|> render("index.html", images: images, search_query: params["q"])
|
||||
else
|
||||
{:error, _msg} ->
|
||||
{:error, msg} ->
|
||||
conn
|
||||
|> render("index.html",
|
||||
images: [],
|
||||
error: msg,
|
||||
search_query: params["q"]
|
||||
)
|
||||
end
|
||||
|
|
|
@ -1 +1,10 @@
|
|||
= render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @images, route: fn p -> Routes.search_path(@conn, :index, p) end, params: [q: @search_query]
|
||||
= 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]
|
||||
- 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