changeset 21ffd80a5a17 in www.tryton.org:default
details: https://hg.tryton.org/www.tryton.org?cmd=changeset;node=21ffd80a5a17
description:
Add custom not found page
issue8398
review251701002
diffstat:
app.py | 5 ++++
static/images/banner-dead-end-400px.jpg | Bin
static/images/banner-dead-end-800px.jpg | Bin
static/images/banner-dead-end.jpg | Bin
templates/layout.html | 4 +++
templates/not_found.html | 40 ++++++++++++++++++++++++++++++++
6 files changed, 49 insertions(+), 0 deletions(-)
diffs (80 lines):
diff -r 76a9697b8ada -r 21ffd80a5a17 app.py
--- a/app.py Wed Jul 10 09:36:36 2019 +0200
+++ b/app.py Wed Jul 10 09:37:45 2019 +0200
@@ -493,6 +493,11 @@
return render_template('service_providers_start.html')
[email protected](HTTPStatus.NOT_FOUND)
+def not_found(error):
+ return render_template('not_found.html'), HTTPStatus.NOT_FOUND
+
+
class RequestFormatter(logging.Formatter):
def format(self, record):
record.url = request.url
diff -r 76a9697b8ada -r 21ffd80a5a17 static/images/banner-dead-end-400px.jpg
Binary file static/images/banner-dead-end-400px.jpg has changed
diff -r 76a9697b8ada -r 21ffd80a5a17 static/images/banner-dead-end-800px.jpg
Binary file static/images/banner-dead-end-800px.jpg has changed
diff -r 76a9697b8ada -r 21ffd80a5a17 static/images/banner-dead-end.jpg
Binary file static/images/banner-dead-end.jpg has changed
diff -r 76a9697b8ada -r 21ffd80a5a17 templates/layout.html
--- a/templates/layout.html Wed Jul 10 09:36:36 2019 +0200
+++ b/templates/layout.html Wed Jul 10 09:37:45 2019 +0200
@@ -8,7 +8,11 @@
<meta name="author" content="Tryton"/>
<meta property="og:title" content="{{ title }}"/>
<meta property="og:type" content="website"/>
+ {% if request.endpoint %}
<meta property="og:url" content="{{ url_for(request.endpoint,
_external=True, **request.view_args) }}"/>
+ {% else %}
+ <meta property="og:url" content="{{ request.url }}"/>
+ {% endif %}
<meta property="og:image" content="{{ url_for('static', filename=(logo
or 'images/logo.png'), _external=True, _scheme='http') }}"/>
<meta property="og:image:secure_url" content="{{ url_for('static',
filename=(logo or 'images/logo.png'), _external=True, _scheme='https') }}"/>
{% if description %}
diff -r 76a9697b8ada -r 21ffd80a5a17 templates/not_found.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/not_found.html Wed Jul 10 09:37:45 2019 +0200
@@ -0,0 +1,40 @@
+{% set title = "Whoops, that page isn't here!" %}
+{% extends "layout.html" %}
+{% from "utils.html" import background %}
+{% block style %}
+{{ super() }}
+{{ background('banner-dead-end') }}
+{% endblock style %}
+{% block content %}
+{{ super() }}
+<section class="section section-banner background-banner-dead-end filter
filter-primary text-center">
+ <div class="container">
+ <h1 class="mb-0 text-white position-relative z-1">
+ <span class="material-icons">sentiment_dissatisfied</span>
+ Sorry, that page isn't here.
+ </h1>
+ </div>
+</section>
+
+<section class="section">
+ <div class="container">
+ <div class="row">
+ <div class="col-sm lg-mx-5 my-5">
+ <h1 style="width: 30rem">
+ We could not find the page you're looking for.
+ </h1>
+ </div>
+ <div class="col-sm lg-mx-5">
+ <p class="lead">Here are some helpful links instead:
+ <ul>
+ <li><a href="{{ url_for('index') }}">Home</a></li>
+ <li><a href="{{ url_for('download') }}">Get Tryton</a></li>
+ <li><a href="{{ url_for('forum') }}">Forum</a></li>
+ <li><a href="{{ url_for('foundation')
}}">Foundation</a></li>
+ <li><a href="{{ url_for('service_providers') }}">Service
Providers</a></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+</section>
+{% endblock content %}