diff --git a/gym/views.py b/gym/views.py index ed94fe9..b237011 100644 --- a/gym/views.py +++ b/gym/views.py @@ -23,24 +23,32 @@ class RoomDetailView(LoginRequiredMixin, QuickActionsMixin, SessionResetMixin, g template_name = 'gym/room.html' def get_quick_actions(self): - return [ + quick_actions = [ { 'url': reverse('rooms-list'), 'category': 'secondary', 'display': 'Liste des salles' }, - { - 'url': "{}?room={}".format(reverse('equipment-create'), self.object.pk), - 'category': 'success', - 'display': 'Ajouter une machine' - }, { 'url': "{}?room={}".format(reverse('session-start'), self.object.pk), 'category': 'primary', 'display': 'Commencer une séance' }, + { + 'url': "{}?room={}".format(reverse('equipment-create'), self.object.pk), + 'category': 'success', + 'display': 'Ajouter une machine' + }, ] + if self.object.latitude and self.object.longitude: + quick_actions.append({ + 'url': f"waze://?ll={self.object.latitude},{self.object.longitude}&navigate=yes", + 'category': 'info', + 'display': 'Waze' + }) + return quick_actions + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['sessions'] = self.object.sessions.all().order_by('-start')