Self hosted FLOSS fitness/workout, nutrition and weight tracker
Show add exercise block to temporary and logged out users
Roland Geider1b1df6d02957
diff --git a/wger/exercises/templates/overview.html b/wger/exercises/templates/overview.htmlindex 21fba1c08..af4ee4da0 100644--- a/wger/exercises/templates/overview.html+++ b/wger/exercises/templates/overview.html@@ -110,9 +110,9 @@ $(document).ready(function() {Side bar-->{% block sidebar %}-{% if user.is_authenticated and not user.get_profile.is_temporary %}<h3>{% trans "Add new exercise" %}</h3><p>+ {% if user.is_authenticated and not user.get_profile.is_temporary %}<a href="{% url 'exercise-add' %}"><img src="{% static 'images/icons/new.svg' %}"width="32"@@ -121,8 +121,18 @@ $(document).ready(function() {title="{% trans 'Add new exercise' %}">{% trans "Add new exercise" %}</a>- </p>-{% endif %}+ {% else %}+ <img src="{% static 'images/icons/new.svg' %}"+ width="32"+ height="32"+ alt="{% trans 'Add new exercise' %}"+ title="{% trans 'Add new exercise' %}">+ <span>+ {% trans "Only registered users can do this" %}+ </span>+ {% endif %}+</p>+{% if perms.exercises %}<h3>{% trans "Options" %}</h3>@@ -163,10 +173,10 @@ $(document).ready(function() {<a href="{% url 'exercisecategory-add' %}"class="modal-dialog"><img src="{% static 'images/icons/folder-new.svg' %}"- width="32"- height="32"- alt="{% trans 'Add category' %}"- title="{% trans 'Add category' %}">+ width="32"+ height="32"+ alt="{% trans 'Add category' %}"+ title="{% trans 'Add category' %}">{% trans "Add category" %}</a></p>diff --git a/wger/exercises/tests/exercise.py b/wger/exercises/tests/exercise.pyindex 14e8d5fe3..3789b64b7 100644--- a/wger/exercises/tests/exercise.py+++ b/wger/exercises/tests/exercise.py@@ -58,9 +58,11 @@ class ExerciseIndexTestCase(WorkoutManagerTestCase):self.assertEqual(exercise_2.id, 2)self.assertEqual(exercise_2.name, "Very cool exercise")+ self.assertContains(response, 'Add new exercise')+# Only authorized users see the edit linksif admin:- self.assertContains(response, 'Add new exercise')+ self.assertNotContains(response, 'Only registered users can do this')self.assertContains(response, 'Edit category')self.assertContains(response, 'Delete category')self.assertContains(response, 'Add category')@@ -70,10 +72,10 @@ class ExerciseIndexTestCase(WorkoutManagerTestCase):self.assertNotContains(response, 'Add category')if logged_in and not demo:- self.assertContains(response, 'Add new exercise')+ self.assertNotContains(response, 'Only registered users can do this')if logged_in and demo:- self.assertNotContains(response, 'Add new exercise')+ self.assertContains(response, 'Only registered users can do this')def test_exercise_index_editor(self):'''