binding of 404 page

pull/2121/head
Victor Baranov 6 years ago
parent 1a9214268c
commit ffadae3306
  1. 5
      apps/block_scout_web/lib/block_scout_web/controller.ex
  2. 8
      apps/block_scout_web/lib/block_scout_web/controllers/page_not_found_controller.ex
  3. 2
      apps/block_scout_web/lib/block_scout_web/router.ex
  4. 4
      apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex
  5. 5
      apps/block_scout_web/lib/block_scout_web/views/page_not_found.ex

@ -12,8 +12,9 @@ defmodule BlockScoutWeb.Controller do
def not_found(conn) do def not_found(conn) do
conn conn
|> put_status(:not_found) |> put_status(:not_found)
|> put_view(BlockScoutWeb.ErrorView) |> put_view(BlockScoutWeb.PageNotFoundView)
|> render("404.html") |> Phoenix.Controller.render(:index)
|> halt()
end end
def unprocessable_entity(conn) do def unprocessable_entity(conn) do

@ -0,0 +1,8 @@
defmodule BlockScoutWeb.PageNotFoundController do
use BlockScoutWeb, :controller
def index(conn, _params) do
conn
|> render("index.html")
end
end

@ -245,5 +245,7 @@ defmodule BlockScoutWeb.Router do
get("/chain_blocks", ChainController, :chain_blocks, as: :chain_blocks) get("/chain_blocks", ChainController, :chain_blocks, as: :chain_blocks)
get("/api_docs", APIDocsController, :index) get("/api_docs", APIDocsController, :index)
get("/:page", PageNotFoundController, :index)
end end
end end

@ -4,8 +4,8 @@
<img alt="Page Not Found" src="/images/errors-img/poa-page-not-found.png" srcset="/images/errors-img/poa-page-not-found@2x.png 2x"> <img alt="Page Not Found" src="/images/errors-img/poa-page-not-found.png" srcset="/images/errors-img/poa-page-not-found@2x.png 2x">
</div> </div>
<div class="block-not-found-content"> <div class="block-not-found-content">
<h1 class="card-title error-title">Lorem Ipsum Dolor</h1> <h1 class="card-title error-title">Page not found</h1>
<p class="error-descr">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua</p> <p class="error-descr">The requested path was not found on BlockScout.</p>
<a class="error-btn btn-line" href="/">Back Home</a> <a class="error-btn btn-line" href="/">Back Home</a>
</div> </div>
</div> </div>

@ -0,0 +1,5 @@
defmodule BlockScoutWeb.PageNotFoundView do
use BlockScoutWeb, :view
@dialyzer :no_match
end
Loading…
Cancel
Save