Add login link to 404 page (#3288)

* Add login link to 404 page

* Fix 404 test

* Fix another test
This commit is contained in:
Uku Taht 2023-08-22 09:45:38 +03:00 committed by GitHub
parent b9fb6fd1a7
commit da3d4366f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 3 deletions

View File

@ -22,6 +22,10 @@
@apply text-indigo-600 bg-transparent border border-indigo-600;
}
.button-outline:hover {
@apply text-white;
}
.button-sm {
@apply px-4 py-2 text-sm;
}

View File

@ -0,0 +1,9 @@
<div class="container flex flex-col items-center text-center mt-24">
<h1 class="text-5xl font-black dark:text-gray-100"><%= @status %></h1>
<div class="mt-4 text-xl dark:text-gray-100">Oops! There's nothing here</div>
<div class="text-xl dark:text-gray-100">Trying to access your dashboard? You may need to log in again to see it</div>
<div class="mt-6 flex">
<%= link("Login", to: Routes.auth_path(@conn, :login_form), class: "button") %>
<%= link("Go to homepage", to: PlausibleWeb.LayoutView.home_dest(@conn), class: "button button-outline ml-2") %>
</div>
</div>

View File

@ -14,7 +14,7 @@ defmodule PlausibleWeb.ErrorView do
|> Map.put(:status, 404)
|> Map.put_new(:message, "Oops! There's nothing here")
render("generic_error.html", assigns)
render("404_error.html", assigns)
end
def render(<<"5", _error_5xx::binary-size(2), ".html">>, assigns) do

View File

@ -45,7 +45,7 @@ defmodule PlausibleWeb.StatsControllerTest do
test "can not view stats of a private website", %{conn: conn} do
conn = get(conn, "/test-site.com")
assert html_response(conn, 404) =~ "There&#39;s nothing here"
assert html_response(conn, 404) =~ "There's nothing here"
end
end
@ -67,7 +67,7 @@ defmodule PlausibleWeb.StatsControllerTest do
test "can not view stats of someone else's website", %{conn: conn} do
site = insert(:site)
conn = get(conn, "/" <> site.domain)
assert html_response(conn, 404) =~ "There&#39;s nothing here"
assert html_response(conn, 404) =~ "There's nothing here"
end
end