Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Use breadcrumbs to ease navigation in gym app

Roland Geiderfd4a5719aec2
diff --git a/requirements.txt b/requirements.txt
index 05c4f0a55..a38679834 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,4 +16,5 @@ easy-thumbnails
django_compressor
icalendar
djangorestframework==2.3.13
-django-filter
\ No newline at end of file
+django-filter
+django-bootstrap-breadcrumbs
\ No newline at end of file
diff --git a/wger/core/templates/base.html b/wger/core/templates/base.html
index 6338c40b0..92397f231 100644
--- a/wger/core/templates/base.html
+++ b/wger/core/templates/base.html
@@ -1,4 +1,4 @@
-{% extends "template.html" %}{% load i18n %}{% load wger_extras %}
+{% extends "template.html" %}{% load i18n wger_extras django_bootstrap_breadcrumbs %}
{% block template %}
{% if trainer_identity %}
<div class="alert alert-info" style="margin-top: 1em;">
@@ -20,6 +20,8 @@ browsing the site as the user "{{current_user}}", all actions are performed on h
{% endfor %}
{% endif %}
+ {% render_breadcrumbs "django_bootstrap_breadcrumbs/bootstrap3.html" %}
+
<div id="content">
{% block content %}{% endblock %}
</div>
diff --git a/wger/core/templates/mobile/template.html b/wger/core/templates/mobile/template.html
index 9de951e0c..88208b95b 100644
--- a/wger/core/templates/mobile/template.html
+++ b/wger/core/templates/mobile/template.html
@@ -1,5 +1,9 @@
<!DOCTYPE html>
-{% load i18n %}{% load staticfiles %}{% load cache %}{% load browserid %}{% load compress %}{% load wger_extras %}
+{% load i18n browserid staticfiles wger_extras compress django_bootstrap_breadcrumbs %}
+{% block breadcrumbs %}
+ {% clear_breadcrumbs %}
+{% endblock %}
+
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 6637ee758..192da3793 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -1,9 +1,9 @@
<!DOCTYPE html>
-{% load i18n %}
-{% load browserid %}
-{% load staticfiles %}
-{% load wger_extras %}
-{% load compress %}
+{% load i18n browserid staticfiles wger_extras compress django_bootstrap_breadcrumbs %}
+{% block breadcrumbs %}
+ {% clear_breadcrumbs %}
+{% endblock %}
+
<html lang="{{language.short_name}}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
diff --git a/wger/core/templates/user/overview.html b/wger/core/templates/user/overview.html
index a521bfd86..70f5ba17f 100644
--- a/wger/core/templates/user/overview.html
+++ b/wger/core/templates/user/overview.html
@@ -1,9 +1,18 @@
{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
+{% load i18n staticfiles wger_extras django_bootstrap_breadcrumbs %}
-{% block title %}{% trans "User" %}: {{current_user|format_username}}{% endblock %}
+{% block title %}{{current_user|format_username}}{% endblock %}
+
+
+{% block breadcrumbs %}
+ {{ block.super }}
+
+ {% if perms.gym.manage_gyms %}
+ {% breadcrumb "Gyms" "gym:gym:list" %}
+ {% endif %}
+ {% breadcrumb_raw current_user.userprofile.gym "gym:gym:user-list" current_user.userprofile.gym.pk %}
+ {% breadcrumb_raw current_user|format_username "core:user-overview" current_user.pk %}
+{% endblock %}
{% block content %}
@@ -17,7 +26,7 @@
<th style="width: 20%;">{% trans "Date" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Number of logs (days)" %}</th>
- <th>{% trans "Last log" %}</th>
+ <th>{% trans "Last activity" %}</th>
</tr>
</thead>
<tbody>
@@ -359,14 +368,4 @@
</td>
</tr>
</table>
-
-
-
-<a href="{% url 'gym:gym:user-list' current_user.userprofile.gym.pk %}" {% auto_link_css flavour %}>
- <img src="{% static 'images/icons/list.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Back to overview' %}">
-{% trans "Back to gym" %}
-</a>
{% endblock %}
diff --git a/wger/gym/templates/admin_notes/list.html b/wger/gym/templates/admin_notes/list.html
index 22d3ca39a..76efe28c4 100644
--- a/wger/gym/templates/admin_notes/list.html
+++ b/wger/gym/templates/admin_notes/list.html
@@ -1,13 +1,23 @@
{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
+{% load i18n staticfiles wger_extras django_bootstrap_breadcrumbs %}
-{% block title %}{{ member|format_username }} - {% trans "User notes" %}{% endblock %}
+{% block title %}{% trans "User notes" %}{% endblock %}
-{% block content %}
+{% block breadcrumbs %}
+ {{ block.super }}
+
+ {% if perms.gym.manage_gyms %}
+ {% breadcrumb "Gyms" "gym:gym:list" %}
+ {% endif %}
+ {% breadcrumb_raw member.userprofile.gym "gym:gym:user-list" member.userprofile.gym.pk %}
+ {% breadcrumb_raw member|format_username "core:user-overview" member.pk %}
+ {% breadcrumb "User notes" "gym:user_notes:list" member.pk %}
+{% endblock %}
+
+
+{% block content %}
<ul class="list-group">
{% for note in adminusernote_list %}
<li class="list-group-item ">
@@ -37,8 +47,8 @@
{% block sidebar %}
-<h4>{% trans "Options" %}</h4>
{% if perms.gym.add_adminusernote %}
+<h4>{% trans "Options" %}</h4>
<p>
<a href="{% url 'gym:admin_note:add' member.pk %}"
{% auto_link_css flavour "wger-modal-dialog" %}>
@@ -51,14 +61,4 @@
</a>
</p>
{% endif %}
-
-<p>
- <a href="{% url 'core:user-overview' member.pk %}" {% auto_link_css flavour %}>
- <img src="{% static 'images/icons/list.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Back' context 'like forward/back not chest/back' %}">
- {% trans 'Back' context 'like forward/back not chest/back' %}
-</a>
-</p>
{% endblock %}
diff --git a/wger/gym/templates/document/list.html b/wger/gym/templates/document/list.html
index 2693759e0..7f4515866 100644
--- a/wger/gym/templates/document/list.html
+++ b/wger/gym/templates/document/list.html
@@ -1,9 +1,19 @@
{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
+{% load i18n staticfiles wger_extras django_bootstrap_breadcrumbs %}
-{% block title %}{{ member|format_username }} - {% trans "Documents" %}{% endblock %}
+{% block title %}{% trans "Documents" %}{% endblock %}
+
+
+{% block breadcrumbs %}
+ {{ block.super }}
+
+ {% if perms.gym.manage_gyms %}
+ {% breadcrumb "Gyms" "gym:gym:list" %}
+ {% endif %}
+ {% breadcrumb_raw member.userprofile.gym "gym:gym:user-list" member.userprofile.gym.pk %}
+ {% breadcrumb_raw member|format_username "core:user-overview" member.pk %}
+ {% breadcrumb "Documents" "gym:document:list" member.pk %}
+{% endblock %}
{% block content %}
@@ -48,8 +58,8 @@
{% block sidebar %}
-<h4>{% trans "Options" %}</h4>
{% if perms.gym.add_userdocument %}
+<h4>{% trans "Options" %}</h4>
<p>
<a href="{% url 'gym:document:add' member.pk %}" {% auto_link_css flavour %}>
<img src="{% static 'images/icons/new.svg' %}"
@@ -61,14 +71,4 @@
</a>
</p>
{% endif %}
-
-<p>
- <a href="{% url 'core:user-overview' member.pk %}" {% auto_link_css flavour %}>
- <img src="{% static 'images/icons/list.svg' %}"
- width="32"
- height="32"
- alt="{% trans 'Back' context 'like forward/back not chest/back' %}">
- {% trans 'Back' context 'like forward/back not chest/back' %}
-</a>
-</p>
{% endblock %}
diff --git a/wger/gym/templates/gym/member_list.html b/wger/gym/templates/gym/member_list.html
index 06c3005fa..57a5ceb75 100644
--- a/wger/gym/templates/gym/member_list.html
+++ b/wger/gym/templates/gym/member_list.html
@@ -1,10 +1,17 @@
{% extends "base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% load wger_extras %}
+{% load i18n staticfiles wger_extras django_bootstrap_breadcrumbs %}
{% block title %}{{gym}}{% endblock %}
+{% block breadcrumbs %}
+ {{ block.super }}
+
+ {% if perms.gym.manage_gyms %}
+ {% breadcrumb "Gyms" "gym:gym:list" %}
+ {% breadcrumb_raw gym "gym:gym:user_list" gym.pk %}
+ {% endif %}
+{% endblock %}
+
{% block header %}
<link rel="stylesheet" type="text/css" href="{% static 'css/jquery.dataTables.css' %}">
diff --git a/wger/settings_global.py b/wger/settings_global.py
index 1a4a986bb..eb473df79 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -66,6 +66,9 @@ TEMPLATE_CONTEXT_PROCESSORS = (
# Django mobile
'django_mobile.context_processors.flavour',
+
+ # Breadcrumbs
+ 'django.core.context_processors.request'
)
# Store the user messages in the session
@@ -227,7 +230,10 @@ INSTALLED_APPS = (
# REST framework
'rest_framework',
- 'rest_framework.authtoken'
+ 'rest_framework.authtoken',
+
+ # Breadcrumbs
+ 'django_bootstrap_breadcrumbs',
)