Improve Backend Error page

Mostly handle things properly when the front-end is missing

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-03-09 19:39:54 +01:00
parent 2133287e26
commit 57662aa690
49 changed files with 4551 additions and 4284 deletions

View File

@@ -10,7 +10,6 @@
font-family: BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, Segoe UI, Fira Sans, Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif;
background: #efeef4;
position: absolute;
text-align: center;
color: #3c376e;
width: 100%;
height: 100%;
@@ -18,6 +17,12 @@
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 0;
}
body.error .dialog {
text-align: center;
}
body.error .dialog h1 {
@@ -43,8 +48,30 @@
</div>
<div class="error__message">
<h1><%= gettext "We're sorry, but something went wrong on our end." %></h1>
<p><%= gettext "The Mobilizon server seems to be temporarily down." %></p>
<p>
<%= gettext("The Mobilizon server %{instance} seems to be temporarily down.", instance: "<b>#{@instance}</b>") |> raw %><br />
<%= if is_nil(@contact) do %>
<%= gettext("If the issue persists, you may try to contact the server administrator.") %>
<% else %>
<%= gettext("If the issue persists, you may contact the server administrator at %{contact}.", contact: cond do
String.contains?(@contact, "@") -> "<a href=\"mailto:#{@contact}\">#{@contact}</a>"
String.match?(@contact, ~r/^https?:\/\/.*/) -> "<a href=\"#{@contact}\">#{@contact}</a>"
true -> @contact
end) |> raw %>
<% end %>
</p>
</div>
</main>
<%= if length(@details) > 0 do %>
<details>
<summary style="font-size: 1.25rem;"><%= gettext("Technical details") %></summary>
<pre>
<%= for detail <- @details do %>
<%= detail %><br>
<% end %>
</pre>
</details>
<% end %>
</body>
</html>