Self hosted FLOSS fitness/workout, nutrition and weight tracker
Show detailed global gym configuration
Roland Geider7fa0e1f29355
diff --git a/wger/gym/templates/gym/list.html b/wger/gym/templates/gym/list.htmlindex a1a1510d9..8aaa2cc3c 100644--- a/wger/gym/templates/gym/list.html+++ b/wger/gym/templates/gym/list.html@@ -25,13 +25,7 @@</li>{% endfor %}</ul>-{% endblock %}----{% block sidebar %}-<h4>{% trans "Options" %}</h4>{% if perms.core.add_gym %}<p><a href="{% url 'gym:gym:add' %}"@@ -45,18 +39,31 @@</a></p>{% endif %}-{% if perms.gym.change_gymconfig %}-<p>- <a href="{% url 'config:gymconfig-edit' %}"- {% auto_link_css flavour "wger-modal-dialog" %}>- <img src="{% static 'images/icons/list.svg' %}"- width="32"- height="32"- alt="{% trans 'Default gym configuration' %}"- title="{% trans 'Default gym configuration' %}">- {% trans "Default gym configuration" %}- </a>-</p>+{% endblock %}+++++{% block sidebar %}+{% if perms.config.change_gymconfig %}+<div class="btn-group pull-right">+ <button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown">+ {% trans "Actions" %} <span class="caret"></span>+ </button>+ <ul class="dropdown-menu" role="menu">+ <li>+ <a href="{% url 'config:gymconfig-edit' %}" class="wger-modal-dialog">{% trans "Edit"%}</a>+ </li>+ </ul>+</div>{% endif %}+<h4>{% trans "Global gym configuration" %}</h4>+<table class="table">+ <tr>+ <th>{% trans "Default gym" %}</th>+ <td>{{ global_gym_config.default_gym|default:"-/-" }}</td>+ </tr>+</table>+{% endblock %}diff --git a/wger/gym/views/gym.py b/wger/gym/views/gym.pyindex fbc30751f..a88244efc 100644--- a/wger/gym/views/gym.py+++ b/wger/gym/views/gym.py@@ -36,6 +36,7 @@ from wger.gym.helpers import get_user_last_activity, is_any_gym_adminfrom wger.gym.models import Gymfrom wger.gym.models import GymAdminConfigfrom wger.gym.models import GymUserConfig+from wger.config.models import GymConfig as GlobalGymConfigfrom wger.utils.generic_views import WgerFormMixinfrom wger.utils.generic_views import WgerDeleteMixin@@ -54,6 +55,14 @@ class GymListView(WgerPermissionMixin, ListView):permission_required = 'gym.manage_gyms'template_name = 'gym/list.html'+ def get_context_data(self, **kwargs):+ '''+ Pass other info to the template+ '''+ context = super(GymListView, self).get_context_data(**kwargs)+ context['global_gym_config'] = GlobalGymConfig.objects.all().first()+ return context+class GymUserListView(WgerPermissionMixin, ListView):'''