diff --git a/gym/templates/gym/equipment.html b/gym/templates/gym/equipment.html
index 73bffa0..0bf3d55 100644
--- a/gym/templates/gym/equipment.html
+++ b/gym/templates/gym/equipment.html
@@ -4,44 +4,6 @@
{% block title %}{{ equipment.name }} ({{ equipment.room.name }}){% endblock %}
{% block h1 %}{{ equipment.name }} ({{ equipment.room.name }}){% endblock %}
-{% block quick_actions %}
-
-{% endblock %}
{% block content %}
diff --git a/gym/views.py b/gym/views.py
index e8e139a..2082c20 100644
--- a/gym/views.py
+++ b/gym/views.py
@@ -45,12 +45,56 @@ class RoomDetailView(LoginRequiredMixin, QuickActionsMixin, SessionResetMixin, g
return context
-class EquipmentDetailView(LoginRequiredMixin, generic.DetailView):
+class EquipmentDetailView(LoginRequiredMixin, QuickActionsMixin, generic.DetailView):
model = Equipment
context_object_name = 'equipment'
template_name = 'gym/equipment.html'
session = None
+ def get_quick_actions(self):
+ lst = []
+
+ if self.session:
+ lst.extend([
+ {
+ 'url': reverse('session-detail', args=(self.session.pk,)),
+ 'category': 'secondary',
+ 'display': 'Retourner à la séance'
+ },
+ {
+ 'url': '{}?equipment={}'.format(reverse('round-create'), self.object.pk),
+ 'category': 'primary',
+ 'display': 'Commencer une série'
+ }
+ ])
+ else:
+ lst.append({
+ 'url': reverse('room-detail', args=(self.object.room.pk,)),
+ 'category': 'secondary',
+ 'display': 'Retourner à la salle'
+ })
+ lst.extend([
+ {
+ 'url': '{}?equipment={}'.format(reverse('setting-create'), self.object.pk),
+ 'category': 'success',
+ 'display': 'Ajouter un réglage'
+ },
+ {
+ 'url': '{}?equipment={}'.format(reverse('theoretical-max-create'), self.object.pk),
+ 'category': 'success',
+ 'display': 'Ajouter un max théorique'
+ }
+ ])
+
+ if self.request.user.is_staff:
+ lst.append({
+ 'url': reverse('admin:gym_equipment_change', args=(self.object.pk,)),
+ 'category': 'warning',
+ 'display': 'Éditer la machine'
+ })
+
+ return lst
+
def dispatch(self, request, *args, **kwargs):
session_pk = self.request.session.get('session_pk')
if session_pk: