-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
916577a
commit 20bd46f
Showing
23 changed files
with
213 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,67 @@ | ||
defmodule CoreWeb.ErrorHTML do | ||
use CoreWeb, :html | ||
use CoreWeb.Layouts.Stripped.Component, :error | ||
|
||
embed_templates("error_html/*") | ||
defp body("403.html", status), do: dgettext("eyra-error", "403.body", status: status) | ||
defp body("404.html", status), do: dgettext("eyra-error", "404.body", status: status) | ||
defp body("500.html", status), do: dgettext("eyra-error", "500.body", status: status) | ||
defp body("503.html", status), do: dgettext("eyra-error", "503.body", status: status) | ||
defp body(_, status), do: dgettext("eyra-error", "generic.body", status: status) | ||
|
||
# By default, Phoenix returns the status message from | ||
# the template name. For example, "404.html" becomes | ||
# "Not Found". | ||
def template_not_found(template, _assigns) do | ||
Phoenix.Controller.status_message_from_template(template) | ||
defp image("403.html"), do: "/images/illustrations/403.svg" | ||
defp image("404.html"), do: "/images/illustrations/404.svg" | ||
defp image("500.html"), do: "/images/illustrations/500.svg" | ||
defp image("503.html"), do: "/images/illustrations/503.svg" | ||
defp image(_), do: nil | ||
|
||
defp status(template), do: Phoenix.Controller.status_message_from_template(template) | ||
|
||
def render(template, assigns) do | ||
status = status(template) | ||
|
||
assigns = | ||
Map.merge(assigns, %{ | ||
menus: build_menus(assigns), | ||
status: status, | ||
body: body(template, status), | ||
image: image(template) | ||
}) | ||
|
||
~H""" | ||
<.error | ||
title={@status} | ||
menus={@menus} | ||
body={@body} | ||
image={@image} | ||
/> | ||
""" | ||
end | ||
|
||
attr(:title, :string, required: true) | ||
attr(:body, :string, required: true) | ||
attr(:image, :string, default: nil) | ||
attr(:menus, :map, required: true) | ||
|
||
def error(assigns) do | ||
~H""" | ||
<.stripped title={@title} menus={@menus} > | ||
<Area.content> | ||
<Margin.y id={:page_top} /> | ||
<div class="flex flex-col md:flex-row gap-10 items-center md:items-start"> | ||
<div> | ||
<div class="text-title3 font-title3 sm:text-title2 lg:text-title1 lg:font-title1 text-grey1"><%= dgettext("eyra-error","page.title") %></div> | ||
<div class="mb-6 md:mb-8"></div> | ||
<div class="text-bodymedium sm:text-bodylarge font-body text-grey1"><%= raw(@body) %></div> | ||
<div class="mb-6 md:mb-8"></div> | ||
</div> | ||
<%= if @image do %> | ||
<div class="flex-shrink-0"> | ||
<img src={@image} alt="" /> | ||
</div> | ||
<% end %> | ||
</div> | ||
</Area.content> | ||
</.stripped> | ||
""" | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title><%= Meta.bundle_title() %></title> | ||
<%= csrf_meta_tag() %> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, height=device-height, viewport-fit=cover, user-scalable=no, initial-scale=1.0" /> | ||
<meta name="theme-color" content="#4272ef"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<script src="https://cdn.jsdelivr.net/gh/alpine-collective/alpine-magic-helpers@1.1.x/dist/index.min.js"></script> | ||
<link | ||
rel="stylesheet" | ||
href="/css/app.css" | ||
/> | ||
<script src="/js/app.js" defer></script> | ||
</head> | ||
<body class="font-body bg-grey5 scrollbar-hide" x-data="{ overlay: false}" > | ||
<div class="fixed z-10 w-full h-full bg-black bg-opacity-20" x-show="overlay"></div> | ||
<div class="flex flex-row"> | ||
<div class="flex flex-col w-full"> | ||
<div class="flex-grow"> | ||
<%= @inner_content %> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.