core: improve error page

This commit is contained in:
Jens Langhammer 2020-11-24 22:46:50 +01:00
parent afbecadba0
commit 3f67da8f54
8 changed files with 35 additions and 31 deletions

View File

@ -1,11 +1,7 @@
{% extends "base/skeleton.html" %} {% extends "base/skeleton.html" %}
{% load static %}
{% load i18n %} {% load i18n %}
{% load passbook_is_active %}
{% load passbook_utils %}
{% block body %} {% block body %}
<pb-messages url="{% url 'passbook_api:messages-list' %}"></pb-messages> <pb-messages url="{% url 'passbook_api:messages-list' %}"></pb-messages>
<div class="pf-c-page"> <div class="pf-c-page">

View File

@ -25,12 +25,10 @@
{% if 'passbook_impersonate_user' in request.session %} {% if 'passbook_impersonate_user' in request.session %}
<div class="pf-c-banner pf-m-warning pf-c-alert pf-m-sticky"> <div class="pf-c-banner pf-m-warning pf-c-alert pf-m-sticky">
<div class="pf-l-flex pf-m-justify-content-center pf-m-justify-content-space-between-on-lg pf-m-nowrap" style="height: 100%;"> <div class="pf-l-flex pf-m-justify-content-center pf-m-justify-content-space-between-on-lg pf-m-nowrap" style="height: 100%;">
<div class=""></div>
<div class="pf-u-display-none pf-u-display-block-on-lg"> <div class="pf-u-display-none pf-u-display-block-on-lg">
{% blocktrans with user=user %}You're currently impersonating {{ user }}.{% endblocktrans %} {% blocktrans with user=user %}You're currently impersonating {{ user }}.{% endblocktrans %}
<a href="{% url 'passbook_core:impersonate-end' %}?back={{ request.get_full_path }}" id="acceptMessage">{% trans 'Stop impersonation' %}</a> <a href="{% url 'passbook_core:impersonate-end' %}?back={{ request.get_full_path }}" id="acceptMessage">{% trans 'Stop impersonation' %}</a>
</div> </div>
<div class=""></div>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -1,24 +1,26 @@
{% extends 'login/base_full.html' %} {% extends 'base/page.html' %}
{% load static %}
{% load i18n %} {% load i18n %}
{% load passbook_utils %} {% load passbook_utils %}
{% block title %} {% block body %}
{% trans card_title %} <section class="pf-c-page__main-section pf-m-no-padding-mobile pf-m-xl">
{% endblock %} <div class="pf-c-empty-state">
<div class="pf-c-empty-state__content">
{% block card_title %} <i class="fas fa-exclamation-circle pf-c-empty-state__icon" aria-hidden="true"></i>
{% trans card_title %} <h1 class="pf-c-title pf-m-lg">
{% endblock %} {% trans title %}
</h1>
{% block card %} <div class="pf-c-empty-state__body">
<form method="POST" class="pf-c-form">
{% if message %} {% if message %}
<h3>{% trans message %}</h3> <h3>{% trans message %}</h3>
{% endif %} {% endif %}
</div>
{% if 'back' in request.GET %} {% if 'back' in request.GET %}
<a href="{% back %}" class="btn btn-primary btn-block btn-lg">{% trans 'Back' %}</a> <a href="{% back %}" class="pf-c-button pf-m-primary pf-m-block">{% trans 'Back' %}</a>
{% endif %} {% endif %}
</form> <a href="/" class="pf-c-button pf-m-primary pf-m-block">{% trans 'Go to home' %}</a>
</div>
</div>
</section>
{% endblock %} {% endblock %}

View File

@ -29,7 +29,7 @@ class ServerErrorTemplateResponse(TemplateResponse, HttpResponseServerError):
class BadRequestView(TemplateView): class BadRequestView(TemplateView):
"""Show Bad Request message""" """Show Bad Request message"""
extra_context = {"card_title": "Bad Request"} extra_context = {"title": "Bad Request"}
response_class = BadRequestTemplateResponse response_class = BadRequestTemplateResponse
template_name = "error/generic.html" template_name = "error/generic.html"
@ -38,7 +38,7 @@ class BadRequestView(TemplateView):
class ForbiddenView(TemplateView): class ForbiddenView(TemplateView):
"""Show Forbidden message""" """Show Forbidden message"""
extra_context = {"card_title": "Forbidden"} extra_context = {"title": "Forbidden"}
response_class = ForbiddenTemplateResponse response_class = ForbiddenTemplateResponse
template_name = "error/generic.html" template_name = "error/generic.html"
@ -47,7 +47,7 @@ class ForbiddenView(TemplateView):
class NotFoundView(TemplateView): class NotFoundView(TemplateView):
"""Show Not Found message""" """Show Not Found message"""
extra_context = {"card_title": "Not Found"} extra_context = {"title": "Not Found"}
response_class = NotFoundTemplateResponse response_class = NotFoundTemplateResponse
template_name = "error/generic.html" template_name = "error/generic.html"
@ -56,7 +56,7 @@ class NotFoundView(TemplateView):
class ServerErrorView(TemplateView): class ServerErrorView(TemplateView):
"""Show Server Error message""" """Show Server Error message"""
extra_context = {"card_title": "Server Error"} extra_context = {"title": "Server Error"}
response_class = ServerErrorTemplateResponse response_class = ServerErrorTemplateResponse
template_name = "error/generic.html" template_name = "error/generic.html"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -307,3 +307,7 @@ input[data-is-monospace] {
.pf-c-content h1 :first-child { .pf-c-content h1 :first-child {
margin-right: var(--pf-global--spacer--sm); margin-right: var(--pf-global--spacer--sm);
} }
.pf-c-empty-state {
height: 100vh;
}

View File

@ -307,3 +307,7 @@ input[data-is-monospace] {
.pf-c-content h1 :first-child { .pf-c-content h1 :first-child {
margin-right: var(--pf-global--spacer--sm); margin-right: var(--pf-global--spacer--sm);
} }
.pf-c-empty-state {
height: 100vh;
}