From 5f9fe0cb98cee76c3b58b932f7103dea4975a859 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 8 Dec 2019 00:12:23 -0500 Subject: [PATCH] fix post navigation --- lib/philomena_web/templates/post/index.html.slime | 2 +- lib/philomena_web/templates/search/index.html.slime | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/philomena_web/templates/post/index.html.slime b/lib/philomena_web/templates/post/index.html.slime index 717f8418..427e42d3 100644 --- a/lib/philomena_web/templates/post/index.html.slime +++ b/lib/philomena_web/templates/post/index.html.slime @@ -15,7 +15,7 @@ h2 Search Results = cond do - Enum.any?(@posts) -> - route = fn p -> Routes.post_path(@conn, :index, p) end - - pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, params: [cq: @conn.params["pq"]], conn: @conn + - pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, params: [pq: @conn.params["pq"]], conn: @conn = for {body, post} <- @posts, post.topic.hidden_from_users == false do = render PhilomenaWeb.PostView, "_post.html", body: body, post: post, conn: @conn diff --git a/lib/philomena_web/templates/search/index.html.slime b/lib/philomena_web/templates/search/index.html.slime index 87627ef1..5f5c52c1 100644 --- a/lib/philomena_web/templates/search/index.html.slime +++ b/lib/philomena_web/templates/search/index.html.slime @@ -1,10 +1,15 @@ = cond do - Enum.any?(@images) -> = render PhilomenaWeb.ImageView, "index.html", conn: @conn, tags: @tags, images: @images, header: "Searching for #{@conn.params["q"]}", route: fn p -> Routes.search_path(@conn, :index, p) end, scope: scope(@conn) + - assigns[:error] -> p ' Oops, there was an error evaluating your query: pre = assigns[:error] + + - blank?(@conn.params["q"]) -> + / Don't render anything. + - true -> p ' No images found!