Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add missing exercise edit history template

Roland Geiderba39f02fba59
diff --git a/wger/core/templates/navigation.html b/wger/core/templates/navigation.html
index 237d05bd8..df19ba4f9 100644
--- a/wger/core/templates/navigation.html
+++ b/wger/core/templates/navigation.html
@@ -68,7 +68,8 @@
{% if user.userprofile.has_exercise_permission %}
<li class="dropdown-divider"></li>
<li class="dropdown-header">{% translate "Administration" %}</li>
- <li><a class="dropdown-item" href="{% url 'exercise:history:overview' %}">{% translate "Exercise edit history" %}</a></li>
+ <li><a class="dropdown-item" href="{% url 'exercise:history:overview' %}">{% translate "Exercise edit stream" %}</a></li>
+ <li><a class="dropdown-item" href="{% url 'exercise:history:overview-history' %}">{% translate "Exercise edit history" %}</a></li>
<li><a class="dropdown-item" href="{% url 'exercise:equipment:list' %}">{% translate "Equipment" %}</a></li>
<li><a class="dropdown-item" href="{% url 'exercise:muscle:admin-list' %}">{% translate "Muscles" %}</a></li>
<li><a class="dropdown-item" href="{% url 'exercise:category:list' %}">{% translate "Categories" %}</a></li>
diff --git a/wger/exercises/templates/history/list.html b/wger/exercises/templates/history/list.html
index 3ef8fa7d9..08be5054f 100644
--- a/wger/exercises/templates/history/list.html
+++ b/wger/exercises/templates/history/list.html
@@ -1,10 +1,10 @@
-{% extends "base.html" %}
+{% extends "base_wide.html" %}
{% load i18n static wger_extras activity_tags %}
<!--
Title
-->
-{% block title %}{% translate "Exercise edit history" %}{% endblock %}
+{% block title %}{% translate "Exercise edit stream" %}{% endblock %}
@@ -23,6 +23,7 @@
<th scope="col">{% translate 'User' %}</th>
<th scope="col">{% translate 'Action' %}</th>
<th scope="col">{% translate 'Object' %}</th>
+ <th scope="col">{% translate 'Time' %}</th>
<th scope="col">{% translate 'Changes' %}</th>
</tr>
</thead>
@@ -35,6 +36,8 @@
<span class="{% fa_class 'plus' %}"></span>
{% elif event.verb == modes.UPDATED.value %}
<span class="{% fa_class 'pen' %}"></span>
+ {% else %}
+ {{ event.verb }}
{% endif %}
</td>
<td>
@@ -44,7 +47,8 @@
{{ event.action_object }}
{% endif %}
</td>
- <td> {{ event.timesince }}</td>
+ <td>{{ event.timesince }}</td>
+ <td>...</td>
</tr>
{% endfor %}
</tbody>
diff --git a/wger/exercises/templates/history/list2.html b/wger/exercises/templates/history/list2.html
new file mode 100644
index 000000000..ec77468a2
--- /dev/null
+++ b/wger/exercises/templates/history/list2.html
@@ -0,0 +1,88 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load static %}
+{% load wger_extras %}
+{% load cache %}
+{% load thumbnail %}
+
+<!--
+ Title
+-->
+{% block title %}{% translate "Exercise edit history" %}{% endblock %}
+
+
+
+{% block header %}
+
+{% endblock %}
+
+
+<!--
+ Main Content
+-->
+{% block content %}
+ <div class="accordion" id="accordionExample">
+ {% for entry in history %}
+ <div class="card">
+ <div class="card-header" id="heading{{ entry.record.history_id }}">
+ <button class="btn btn-link btn-block text-left"
+ type="button"
+ data-toggle="collapse"
+ data-target="#collapse{{ entry.record.history_id }}"
+ aria-expanded="true"
+ aria-controls="collapse{{ entry.record.history_id }}">
+ History entry for {{ entry.record.instance.name }}
+ <small>{{ entry.record.history_date }}</small>
+ </button>
+ </div>
+ <div id="collapse{{ entry.record.history_id }}"
+ class="collapse"
+ aria-labelledby="heading{{ entry.record.history_id }}"
+ data-parent="#accordionExample">
+ <div class="card-body">
+ {% if entry.record.history_type == '~' %}
+ <table class="table">
+ <thead>
+ <tr>
+ <td>Field</td>
+ <td>Old</td>
+ <td>New</td>
+ </tr>
+ </thead>
+ <tbody>
+ {% if entry.delta %}
+ {% for change in entry.delta.changes %}
+ <tr>
+ <td>{{ change.field }}</td>
+ <td>{{ change.old }}</td>
+ <td>{{ change.new }}</td>
+ </tr>
+ {% endfor %}
+ {% endif %}
+ </tbody>
+ </table>
+ {% elif entry.record.history_type == '-' %}
+ <p>Entry deleted</p>
+ {% elif entry.record.history_type == '+' %}
+ <p>Entry created</p>
+ {% endif %}
+ </div>
+ </div>
+ </div>
+ {% endfor %}
+ </div>
+{% endblock %}
+
+
+<!--
+ Side bar
+-->
+{% block sidebar %}
+
+{% endblock %}
+
+
+
+{% block options %}
+
+{% endblock %}
diff --git a/wger/exercises/urls.py b/wger/exercises/urls.py
index a7721185c..bcab54bda 100644
--- a/wger/exercises/urls.py
+++ b/wger/exercises/urls.py
@@ -39,6 +39,7 @@ from wger.exercises.views import (
# sub patterns for history
patterns_history = [
path('overview/', history.overview, name='overview'),
+ path('overview-history/', history.overview2, name='overview-history'),
]
# sub patterns for muscles
diff --git a/wger/exercises/views/history.py b/wger/exercises/views/history.py
index f0644a4ab..b7d535c10 100644
--- a/wger/exercises/views/history.py
+++ b/wger/exercises/views/history.py
@@ -44,6 +44,7 @@ def overview(request):
# https://stackoverflow.com/questions/35953132/
'modes': HistoryModes.__members__
}
+
return render(request, 'history/list.html', context)