From 850087f628201e9744cab932f15164d3f1af4fe8 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch <pjentsch@sfb1288inf-Notebook.fritz.box>
Date: Mon, 2 Nov 2020 10:01:02 +0100
Subject: [PATCH] Add breadcrumbs to auth package

---
 web/app/auth/views.py                             |  3 ++-
 web/app/templates/auth/_breadcrumbs.html.j2       | 15 +++++++++++++++
 web/app/templates/auth/login.html.j2              |  4 ++++
 web/app/templates/auth/register.html.j2           |  4 ++++
 web/app/templates/auth/reset_password.html.j2     |  4 ++++
 .../templates/auth/reset_password_request.html.j2 |  4 ++++
 web/app/templates/auth/unconfirmed.html.j2        |  4 ++++
 7 files changed, 37 insertions(+), 1 deletion(-)
 create mode 100644 web/app/templates/auth/_breadcrumbs.html.j2

diff --git a/web/app/auth/views.py b/web/app/auth/views.py
index c0fe6934..c1fe37ed 100644
--- a/web/app/auth/views.py
+++ b/web/app/auth/views.py
@@ -153,4 +153,5 @@ def reset_password(token):
             return redirect(url_for('main.index'))
     return render_template('auth/reset_password.html.j2',
                            reset_password_form=reset_password_form,
-                           title='Password Reset')
+                           title='Password Reset',
+                           token=token)
diff --git a/web/app/templates/auth/_breadcrumbs.html.j2 b/web/app/templates/auth/_breadcrumbs.html.j2
new file mode 100644
index 00000000..1d26cb5d
--- /dev/null
+++ b/web/app/templates/auth/_breadcrumbs.html.j2
@@ -0,0 +1,15 @@
+<ul class="tabs tabs-transparent">
+  <li class="tab"><a href="{{ url_for('main.index') }}" target="_self">nopaque</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% if request.path == url_for('.login') %}
+  <li class="tab"><a class="active" href="{{ url_for('.login') }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.register') %}
+  <li class="tab"><a class="active" href="{{ url_for('.register') }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.reset_password', token=token) %}
+  <li class="tab"><a class="active" href="{{ url_for('.reset_password', token=token) }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.reset_password_request') %}
+  <li class="tab"><a class="active" href="{{ url_for('.reset_password_request') }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.unconfirmed') %}
+  <li class="tab"><a class="active" href="{{ url_for('.unconfirmed') }}" target="_self">{{ title }}</a></li>
+  {% endif %}
+</ul>
diff --git a/web/app/templates/auth/login.html.j2 b/web/app/templates/auth/login.html.j2
index 657da25f..fa99f31a 100644
--- a/web/app/templates/auth/login.html.j2
+++ b/web/app/templates/auth/login.html.j2
@@ -1,6 +1,10 @@
 {% extends "nopaque.html.j2" %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'auth/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block styles %}
 {{ super() }}
 <style>
diff --git a/web/app/templates/auth/register.html.j2 b/web/app/templates/auth/register.html.j2
index 9909cd60..e41990b3 100644
--- a/web/app/templates/auth/register.html.j2
+++ b/web/app/templates/auth/register.html.j2
@@ -1,6 +1,10 @@
 {% extends "nopaque.html.j2" %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'auth/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block styles %}
 {{ super() }}
 <style>
diff --git a/web/app/templates/auth/reset_password.html.j2 b/web/app/templates/auth/reset_password.html.j2
index f3e4f26e..21da27db 100644
--- a/web/app/templates/auth/reset_password.html.j2
+++ b/web/app/templates/auth/reset_password.html.j2
@@ -1,6 +1,10 @@
 {% extends "nopaque.html.j2" %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'auth/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/auth/reset_password_request.html.j2 b/web/app/templates/auth/reset_password_request.html.j2
index 403f1388..0a2baf9f 100644
--- a/web/app/templates/auth/reset_password_request.html.j2
+++ b/web/app/templates/auth/reset_password_request.html.j2
@@ -1,6 +1,10 @@
 {% extends "nopaque.html.j2" %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'auth/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/auth/unconfirmed.html.j2 b/web/app/templates/auth/unconfirmed.html.j2
index 613c51a4..d2b1e359 100644
--- a/web/app/templates/auth/unconfirmed.html.j2
+++ b/web/app/templates/auth/unconfirmed.html.j2
@@ -1,5 +1,9 @@
 {% extends "nopaque.html.j2" %}
 
+{% block nav_content %}
+{% include 'auth/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
-- 
GitLab