Add waze link in room detail

This commit is contained in:
Gabriel Augendre 2018-04-02 14:34:27 +02:00
parent 0d88f255c5
commit 17b2415d08
No known key found for this signature in database
GPG key ID: F360212F958357D4

View file

@ -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')