From 88f32e9195f232d2ceeb1026e9a691185dc1e5f3 Mon Sep 17 00:00:00 2001
From: Patrick Jentsch <p.jentsch@uni-bielefeld.de>
Date: Fri, 30 Oct 2020 15:01:41 +0100
Subject: [PATCH] breadcrumbs intermediate

---
 web/app/templates/_roadmap.html.j2            | 28 +++++++++++++++++
 .../templates/corpora/_breadcrumbs.html.j2    | 27 ++++++++++++++++
 .../templates/corpora/add_corpus_file.html.j2 |  4 +++
 web/app/templates/corpora/corpus_file.html.j2 |  6 +++-
 web/app/templates/jobs/_breadcrumbs.html.j2   |  9 ++++++
 web/app/templates/jobs/job.html.j2            |  4 +++
 web/app/templates/main/_breadcrumbs.html.j2   | 15 +++++++++
 web/app/templates/main/about_and_faq.html.j2  |  4 +++
 web/app/templates/main/dashboard.html.j2      |  4 +++
 web/app/templates/main/index.html.j2          |  4 +++
 web/app/templates/main/news.html.j2           |  4 +++
 web/app/templates/main/privacy_policy.html.j2 |  4 +++
 web/app/templates/main/terms_of_use.html.j2   |  4 +++
 web/app/templates/nopaque.html.j2             | 31 +------------------
 .../templates/settings/_breadcrumbs.html.j2   | 13 ++++++++
 .../settings/change_password.html.j2          |  4 +++
 .../settings/edit_general_settings.html.j2    |  4 +++
 .../edit_notification_settings.html.j2        |  4 +++
 18 files changed, 142 insertions(+), 31 deletions(-)
 create mode 100644 web/app/templates/_roadmap.html.j2
 create mode 100644 web/app/templates/corpora/_breadcrumbs.html.j2
 create mode 100644 web/app/templates/jobs/_breadcrumbs.html.j2
 create mode 100644 web/app/templates/main/_breadcrumbs.html.j2
 create mode 100644 web/app/templates/settings/_breadcrumbs.html.j2

diff --git a/web/app/templates/_roadmap.html.j2 b/web/app/templates/_roadmap.html.j2
new file mode 100644
index 00000000..da756093
--- /dev/null
+++ b/web/app/templates/_roadmap.html.j2
@@ -0,0 +1,28 @@
+{% if current_user.is_authenticated %}
+<ul class="tabs tabs-transparent">
+  <li class="tab disabled"><a><i class="material-icons left">explore</i>Roadmap</a></li>
+  <li class="tab"><a{%if request.path == url_for('services.service', service='file-setup') %} class="active"{% endif %} href="{{ url_for('services.service', service='file-setup') }}" target="_self">File setup</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a{%if request.path == url_for('services.service', service='ocr') %} class="active"{% endif %} href="{{ url_for('services.service', service='ocr') }}" target="_self">OCR</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a{%if request.path == url_for('services.service', service='nlp') %} class="active"{% endif %} href="{{ url_for('services.service', service='nlp') }}" target="_self">NLP</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a{%if request.path == url_for('corpora.add_corpus') %} class="active"{% endif %} href="{{ url_for('corpora.add_corpus') }}" target="_self">Add corpus</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% if corpus %}
+  <li class="tab"><a{%if request.path == url_for('corpora.add_corpus_file', corpus_id=corpus.id) %} class="active"{% endif %} href="{{ url_for('corpora.add_corpus_file', corpus_id=corpus.id) }}" target="_self">Add corpus file(s)</a></li>
+  {% else %}
+  <li class="tab disabled tooltipped" data-tooltip="Select a corpus first"><a>Add corpus file(s)</a></li>
+  {% endif %}
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% if corpus %}
+  {% if corpus.files.all() %}
+  <li class="tab"><a{%if request.path == url_for('corpora.analyse_corpus', corpus_id=corpus.id) %} class="active"{% endif %} href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}" target="_self">Corpus analysis</a></li>
+  {% else %}
+  <li class="tab disabled tooltipped" data-tooltip="Add at least one corpus file first"><a>Corpus analysis</a></li>
+  {% endif %}
+  {% else %}
+  <li class="tab disabled tooltipped" data-tooltip="Select a corpus first"><a>Corpus analysis</a></li>
+  {% endif %}
+</ul>
+{% endif %}
diff --git a/web/app/templates/corpora/_breadcrumbs.html.j2 b/web/app/templates/corpora/_breadcrumbs.html.j2
new file mode 100644
index 00000000..053f4061
--- /dev/null
+++ b/web/app/templates/corpora/_breadcrumbs.html.j2
@@ -0,0 +1,27 @@
+<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>
+  <li class="tab"><a href="{{ url_for('main.dashboard', _anchor='jobs') }}" target="_self">My corpora</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% if request.path == url_for('.add_corpus') %}
+  <li class="tab"><a class="active" href="{{ url_for('.add_corpus') }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.corpus', corpus_id=corpus.id) %}
+  <li class="tab"><a class="active" href="{{ url_for('.corpus', corpus_id=corpus.id) }}" target="_self">{{ corpus.title }}</a></li>
+  {% elif request.path == url_for('.analyse_corpus', corpus_id=corpus.id) %}
+  <li class="tab"><a href="{{ url_for('.corpus', corpus_id=corpus.id) }}" target="_self">{{ corpus.title }}</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a class="active" href="{{ url_for('.analyse_corpus', corpus_id=corpus.id) }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.add_corpus_file', corpus_id=corpus.id) %}
+  <li class="tab"><a href="{{ url_for('.corpus', corpus_id=corpus.id) }}" target="_self">{{ corpus.title }}</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a href="{{ url_for('.corpus', corpus_id=corpus.id, _anchor='files') }}" target="_self">Corpus files</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a class="active" href="{{ url_for('.add_corpus_file', corpus_id=corpus.id) }}" target="_self">{{ title }}</a></li>
+  {% elif request.path == url_for('.corpus_file', corpus_file_id=corpus_file.id, corpus_id=corpus.id) %}
+  <li class="tab"><a href="{{ url_for('.corpus', corpus_id=corpus.id) }}" target="_self">{{ corpus.title }}</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a href="{{ url_for('.corpus', corpus_id=corpus.id, _anchor='files') }}" target="_self">Corpus files</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  <li class="tab"><a class="active" href="{{ url_for('.corpus_file', corpus_file_id=corpus_file.id, corpus_id=corpus.id) }}" target="_self">{{ corpus_file.author }}: {{ corpus_file.title }} ({{ corpus_file.publishing_year }})</a></li>
+  {% endif %}
+</ul>
diff --git a/web/app/templates/corpora/add_corpus_file.html.j2 b/web/app/templates/corpora/add_corpus_file.html.j2
index 70f72834..4ca54776 100644
--- a/web/app/templates/corpora/add_corpus_file.html.j2
+++ b/web/app/templates/corpora/add_corpus_file.html.j2
@@ -5,6 +5,10 @@
 {% set scheme_primary_color = colors.corpus_analysis_darken %}
 {% set scheme_secondary_color = colors.corpus_analysis %}
 
+{% block nav_content %}
+{% include 'corpora/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block main_attribs %} class="corpus-analysis-color lighten"{% endblock main_attribs %}
 
 {% block page_content %}
diff --git a/web/app/templates/corpora/corpus_file.html.j2 b/web/app/templates/corpora/corpus_file.html.j2
index 4f02a085..7548604b 100644
--- a/web/app/templates/corpora/corpus_file.html.j2
+++ b/web/app/templates/corpora/corpus_file.html.j2
@@ -5,13 +5,17 @@
 {% set scheme_primary_color = colors.corpus_analysis_darken %}
 {% set scheme_secondary_color = colors.corpus_analysis %}
 
+{% block nav_content %}
+{% include 'corpora/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block main_attribs %} class="corpus-analysis-color lighten"{% endblock main_attribs %}
 
 {% block page_content %}
 <div class="container">
   <div class="row">
     <div class="col s12">
-      <h1 id="title">{{ corpus_file.author }}: {{ corpus_file.title }}</h1>
+      <h1 id="title">{{ corpus_file.author }}: {{ corpus_file.title }} ({{ corpus_file.publishing_year }})</h1>
     </div>
 
     <div class="col s12">
diff --git a/web/app/templates/jobs/_breadcrumbs.html.j2 b/web/app/templates/jobs/_breadcrumbs.html.j2
new file mode 100644
index 00000000..dabad5b5
--- /dev/null
+++ b/web/app/templates/jobs/_breadcrumbs.html.j2
@@ -0,0 +1,9 @@
+<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>
+  <li class="tab"><a href="{{ url_for('main.dashboard', _anchor='jobs') }}" target="_self">My jobs</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% if request.path == url_for('.job', job_id=job.id) %}
+  <li class="tab"><a class="active" href="{{ url_for('.job', job_id=job.id) }}" target="_self">{{ job.title }}</a></li>
+  {% endif %}
+</ul>
diff --git a/web/app/templates/jobs/job.html.j2 b/web/app/templates/jobs/job.html.j2
index 7cbc49ba..d23accfb 100644
--- a/web/app/templates/jobs/job.html.j2
+++ b/web/app/templates/jobs/job.html.j2
@@ -15,6 +15,10 @@
   {% set scheme_color = colors.ocr_darken %}
 {% endif %}
 
+{% block nav_content %}
+{% include 'jobs/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block main_attribs %} class="{{ main_class }}"{% endblock main_attribs %}
 
 {% block page_content %}
diff --git a/web/app/templates/main/_breadcrumbs.html.j2 b/web/app/templates/main/_breadcrumbs.html.j2
new file mode 100644
index 00000000..f3c4f98c
--- /dev/null
+++ b/web/app/templates/main/_breadcrumbs.html.j2
@@ -0,0 +1,15 @@
+<ul class="tabs tabs-transparent">
+  <li class="tab"><a href="{{ url_for('.index') }}" target="_self">nopaque</a></li>
+  {% if not (request.path == url_for('.index')) %}
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% endif %}
+  {% if request.path == url_for('.about_and_faq') %}
+  <li class="tab"><a class="active" href="{{ url_for('.about_and_faq') }}" target="_self">About and faq</a></li>
+  {% elif request.path == url_for('.dashboard') %}
+  <li class="tab"><a class="active" href="{{ url_for('.dashboard') }}" target="_self">Dashboard</a></li>
+  {% elif request.path == url_for('.news') %}
+  <li class="tab"><a class="active" href="{{ url_for('.news') }}" target="_self">News</a></li>
+  {% elif request.path == url_for('.terms_of_use') %}
+  <li class="tab"><a class="active" href="{{ url_for('.terms_of_use') }}" target="_self">Terms of use</a></li>
+  {% endif %}
+</ul>
diff --git a/web/app/templates/main/about_and_faq.html.j2 b/web/app/templates/main/about_and_faq.html.j2
index 24e87d67..cdae8dca 100644
--- a/web/app/templates/main/about_and_faq.html.j2
+++ b/web/app/templates/main/about_and_faq.html.j2
@@ -1,5 +1,9 @@
 {% extends "nopaque.html.j2" %}
 
+{% block nav_content %}
+{% include 'main/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/main/dashboard.html.j2 b/web/app/templates/main/dashboard.html.j2
index b014ecba..3d3018a8 100644
--- a/web/app/templates/main/dashboard.html.j2
+++ b/web/app/templates/main/dashboard.html.j2
@@ -1,5 +1,9 @@
 {% extends "nopaque.html.j2" %}
 
+{% block nav_content %}
+{% include 'main/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/main/index.html.j2 b/web/app/templates/main/index.html.j2
index dbc32c3e..8268de6a 100644
--- a/web/app/templates/main/index.html.j2
+++ b/web/app/templates/main/index.html.j2
@@ -1,6 +1,10 @@
 {% extends "nopaque.html.j2" %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'main/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="section white">
   <div class="row container">
diff --git a/web/app/templates/main/news.html.j2 b/web/app/templates/main/news.html.j2
index c7947530..7b90f497 100644
--- a/web/app/templates/main/news.html.j2
+++ b/web/app/templates/main/news.html.j2
@@ -1,5 +1,9 @@
 {% extends "nopaque.html.j2" %}
 
+{% block nav_content %}
+{% include 'main/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/main/privacy_policy.html.j2 b/web/app/templates/main/privacy_policy.html.j2
index 71c469bf..dc8052ca 100644
--- a/web/app/templates/main/privacy_policy.html.j2
+++ b/web/app/templates/main/privacy_policy.html.j2
@@ -1,5 +1,9 @@
 {% extends "nopaque.html.j2" %}
 
+{% block nav_content %}
+{% include 'main/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/main/terms_of_use.html.j2 b/web/app/templates/main/terms_of_use.html.j2
index dbe39dc9..dba392a0 100644
--- a/web/app/templates/main/terms_of_use.html.j2
+++ b/web/app/templates/main/terms_of_use.html.j2
@@ -1,5 +1,9 @@
 {% extends "nopaque.html.j2" %}
 
+{% block nav_content %}
+{% include 'main/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/nopaque.html.j2 b/web/app/templates/nopaque.html.j2
index 94902c93..6a66440e 100644
--- a/web/app/templates/nopaque.html.j2
+++ b/web/app/templates/nopaque.html.j2
@@ -99,36 +99,7 @@
       </ul>
     </div>
     <div class="nav-content secondary-color">
-      {% block nav_content %}
-      {% if current_user.is_authenticated %}
-      <ul class="tabs tabs-transparent">
-        <li class="tab disabled"><a><i class="material-icons left">explore</i>Roadmap</a></li>
-        <li class="tab"><a{%if request.path == url_for('services.service', service='file-setup') %} class="active"{% endif %} href="{{ url_for('services.service', service='file-setup') }}" target="_self">File setup</a></li>
-        <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
-        <li class="tab"><a{%if request.path == url_for('services.service', service='ocr') %} class="active"{% endif %} href="{{ url_for('services.service', service='ocr') }}" target="_self">OCR</a></li>
-        <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
-        <li class="tab"><a{%if request.path == url_for('services.service', service='nlp') %} class="active"{% endif %} href="{{ url_for('services.service', service='nlp') }}" target="_self">NLP</a></li>
-        <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
-        <li class="tab"><a{%if request.path == url_for('corpora.add_corpus') %} class="active"{% endif %} href="{{ url_for('corpora.add_corpus') }}" target="_self">Add corpus</a></li>
-        <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
-        {% if corpus %}
-        <li class="tab"><a{%if request.path == url_for('corpora.add_corpus_file', corpus_id=corpus.id) %} class="active"{% endif %} href="{{ url_for('corpora.add_corpus_file', corpus_id=corpus.id) }}" target="_self">Add corpus file(s)</a></li>
-        {% else %}
-        <li class="tab disabled tooltipped" data-tooltip="Select a corpus first"><a>Add corpus file(s)</a></li>
-        {% endif %}
-        <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
-        {% if corpus %}
-        {% if corpus.files.all() %}
-        <li class="tab"><a{%if request.path == url_for('corpora.analyse_corpus', corpus_id=corpus.id) %} class="active"{% endif %} href="{{ url_for('corpora.analyse_corpus', corpus_id=corpus.id) }}" target="_self">Corpus analysis</a></li>
-        {% else %}
-        <li class="tab disabled tooltipped" data-tooltip="Add at least one corpus file first"><a>Corpus analysis</a></li>
-        {% endif %}
-        {% else %}
-        <li class="tab disabled tooltipped" data-tooltip="Select a corpus first"><a>Corpus analysis</a></li>
-        {% endif %}
-      </ul>
-      {% endif %}
-      {% endblock nav_content %}
+      {% block nav_content %}{% endblock nav_content %}
     </div>
   </nav>
 </div>
diff --git a/web/app/templates/settings/_breadcrumbs.html.j2 b/web/app/templates/settings/_breadcrumbs.html.j2
new file mode 100644
index 00000000..a0d061b8
--- /dev/null
+++ b/web/app/templates/settings/_breadcrumbs.html.j2
@@ -0,0 +1,13 @@
+<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>
+  <li class="tab"><a{%if request.path == url_for('settings.index') %} class="active"{% endif %} href="{{ url_for('settings.index') }}" target="_self">Settings</a></li>
+  <li class="tab disabled"><i class="material-icons">navigate_next</i></li>
+  {% if request.path == url_for('settings.change_password') %}
+  <li class="tab"><a class="active" href="{{ url_for('settings.change_password') }}" target="_self">Change password</a></li>
+  {% elif request.path == url_for('settings.edit_general_settings') %}
+  <li class="tab"><a class="active" href="{{ url_for('settings.edit_general_settings') }}" target="_self">Edit general settings</a></li>
+  {% elif request.path == url_for('settings.edit_notification_settings') %}
+  <li class="tab"><a class="active" href="{{ url_for('settings.edit_notification_settings') }}" target="_self">Edit notification settings</a></li>
+  {% endif %}
+</ul>
diff --git a/web/app/templates/settings/change_password.html.j2 b/web/app/templates/settings/change_password.html.j2
index 771886bf..6cee5907 100644
--- a/web/app/templates/settings/change_password.html.j2
+++ b/web/app/templates/settings/change_password.html.j2
@@ -1,6 +1,10 @@
 {% extends 'nopaque.html.j2' %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'settings/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/settings/edit_general_settings.html.j2 b/web/app/templates/settings/edit_general_settings.html.j2
index 18eff4d7..5e3b6428 100644
--- a/web/app/templates/settings/edit_general_settings.html.j2
+++ b/web/app/templates/settings/edit_general_settings.html.j2
@@ -1,6 +1,10 @@
 {% extends 'nopaque.html.j2' %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'settings/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
diff --git a/web/app/templates/settings/edit_notification_settings.html.j2 b/web/app/templates/settings/edit_notification_settings.html.j2
index 2a8e7b24..2736c1a3 100644
--- a/web/app/templates/settings/edit_notification_settings.html.j2
+++ b/web/app/templates/settings/edit_notification_settings.html.j2
@@ -1,6 +1,10 @@
 {% extends 'nopaque.html.j2' %}
 {% import 'materialize/wtf.html.j2' as wtf %}
 
+{% block nav_content %}
+{% include 'settings/_breadcrumbs.html.j2' %}
+{% endblock nav_content %}
+
 {% block page_content %}
 <div class="container">
   <div class="row">
-- 
GitLab