Add Timer detail template (WIP).

This commit is contained in:
Christopher Charbonneau Wells 2017-08-17 23:45:56 -04:00
parent b4eefea7f9
commit 24d797db01
4 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,19 @@
{% extends 'babyblotter/page.html' %}
{% block title %}{{ object }}{% endblock %}
{% block content %}
<div class="jumbotron text-center">
<h1 class="display-1">{{ object.duration }}</h1>
<p class="lead text-muted">Started {{ object.start }} by {{ object.user }}</p>
<a class="btn btn-success btn-lg btn-block p-3 mb-3" href="{% url 'feeding-add' %}" role="button">
<i class="fa fa-spoon" aria-hidden="true"></i> Feeding</a>
<a class="btn btn-success btn-lg btn-block p-3 mb-3" href="{% url 'sleep-add' %}" role="button">
<i class="fa fa-bed" aria-hidden="true"></i> Sleep</a>
<a class="btn btn-success btn-lg btn-block p-3 mb-3" href="{% url 'tummytime-add' %}" role="button">
<i class="fa fa-smile-o" aria-hidden="true"></i> Tummy Time</a>
<a class="btn btn-danger btn-lg btn-block p-3 mb-3" href="#" role="button">
<i class="fa fa-times-circle" aria-hidden="true"></i> Delete Timer</a>
</p>
</div>
{% endblock %}

View File

@ -14,7 +14,7 @@
{% endif %}
{% endif %}
{% for timer in timers %}
<button class="dropdown-item" type="button">{{ timer }}</button>
<a class="dropdown-item" href="{% url 'timer-detail' timer.id %}">{{ timer }}</a>
{% endfor %}
</div>
</li>

View File

@ -48,6 +48,8 @@ urlpatterns = [
url(r'timer/add/$', views.TimerAdd.as_view(), name='timer-add'),
url(r'timer/add/quick/$', views.TimerAddQuick.as_view(),
name='timer-add-quick'),
url(r'timer/(?P<pk>[0-9]+)/$', views.TimerDetail.as_view(),
name='timer-detail'),
url(r'tummy-time/$', views.TummyTimeList.as_view(), name='tummytime-list'),
url(r'tummy-time/add/$', views.TummyTimeAdd.as_view(),

View File

@ -5,6 +5,7 @@ from django.core.urlresolvers import resolve
from django.contrib.auth.mixins import (LoginRequiredMixin,
PermissionRequiredMixin)
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.views.generic.list import ListView
@ -142,6 +143,12 @@ class SleepDelete(PermissionRequiredMixin, DeleteView):
success_url = '/sleep'
class TimerDetail(PermissionRequiredMixin, DetailView):
model = Timer
template_name = 'timer_detail.html' # To be consistent w/Timer templates.
permission_required = ('core.view_timer',)
class TimerAdd(PermissionRequiredMixin, CreateView):
model = Timer
permission_required = ('core.add_timer',)