mirror of https://github.com/snachodog/mybuddy.git
Add last Sleep and Tummy Time cards and change to a card columns layout.
This commit is contained in:
parent
e92050cb44
commit
63faa0b553
|
@ -0,0 +1,13 @@
|
|||
<div class="card border-dark mb-3">
|
||||
<div class="card-header text-white bg-dark h4">
|
||||
<i class="fa fa-bed pull-left" aria-hidden="true"></i>
|
||||
{% block header %}{% endblock %}
|
||||
</div>
|
||||
<div class="card-body text-dark">
|
||||
<h4 class="card-title">{% block title %}{% endblock %}</h4>
|
||||
<div class="card-text">{% block content %}{% endblock %}</div>
|
||||
</div>
|
||||
<div class="card-footer text-muted">
|
||||
{% block footer %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,15 @@
|
|||
{% extends 'cards/sleep.html' %}
|
||||
|
||||
{% block header %}Last Slept{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
<strong>{{ sleep.end|timesince }}</strong> ago
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="text-muted">
|
||||
{{ sleep.duration }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}{{ sleep.end }}{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
<div class="card border-success mb-3">
|
||||
<div class="card-header text-white bg-success h4">
|
||||
<i class="fa fa-smile-o pull-left" aria-hidden="true"></i>
|
||||
{% block header %}{% endblock %}
|
||||
</div>
|
||||
<div class="card-body text-success">
|
||||
<h4 class="card-title">{% block title %}{% endblock %}</h4>
|
||||
<div class="card-text">{% block content %}{% endblock %}</div>
|
||||
</div>
|
||||
<div class="card-footer text-muted">
|
||||
{% block footer %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,18 @@
|
|||
{% extends 'cards/tummytime.html' %}
|
||||
|
||||
{% block header %}Last Tummy Time{% endblock %}
|
||||
|
||||
{% block title %}
|
||||
<strong>{{ tummytime.end|timesince }}</strong> ago
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="text-muted">
|
||||
{{ tummytime.duration }}
|
||||
{% if tummytime.milestone %}
|
||||
<br /> {{ tummytime.milestone }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}{{ tummytime.end }}{% endblock %}
|
|
@ -5,28 +5,10 @@
|
|||
|
||||
{% block content %}
|
||||
<h1 class="text-center">{{ object }}</h1>
|
||||
<div class="container">
|
||||
<div class="row align-items-start text-center">
|
||||
<div class="col-sm-12 col-md-4">
|
||||
{% card_feeding_last object %}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-4">
|
||||
{% card_diaperchange_last object %}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-4">
|
||||
change statistics
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-start text-center">
|
||||
<div class="col-sm-12 col-md-4">
|
||||
tummy time for the day
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-4">
|
||||
available
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-4">
|
||||
available
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-columns">
|
||||
{% card_feeding_last object %}
|
||||
{% card_diaperchange_last object %}
|
||||
{% card_tummytime_last object %}
|
||||
{% card_sleep_last object %}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
|||
|
||||
from django import template
|
||||
|
||||
from core.models import DiaperChange, Feeding
|
||||
from core.models import DiaperChange, Feeding, Sleep, TummyTime
|
||||
|
||||
|
||||
register = template.Library()
|
||||
|
@ -11,13 +11,24 @@ register = template.Library()
|
|||
|
||||
@register.inclusion_tag('cards/feeding_last.html')
|
||||
def card_feeding_last(child):
|
||||
feeding_instance = Feeding.objects.filter(
|
||||
child=child).order_by('-end').first()
|
||||
return {'feeding': feeding_instance}
|
||||
instance = Feeding.objects.filter(child=child).order_by('-end').first()
|
||||
return {'feeding': instance}
|
||||
|
||||
|
||||
@register.inclusion_tag('cards/diaperchange_last.html')
|
||||
def card_diaperchange_last(child):
|
||||
feeding_instance = DiaperChange.objects.filter(
|
||||
instance = DiaperChange.objects.filter(
|
||||
child=child).order_by('-time').first()
|
||||
return {'change': feeding_instance}
|
||||
return {'change': instance}
|
||||
|
||||
|
||||
@register.inclusion_tag('cards/tummytime_last.html')
|
||||
def card_tummytime_last(child):
|
||||
instance = TummyTime.objects.filter(child=child).order_by('-end').first()
|
||||
return {'tummytime': instance}
|
||||
|
||||
|
||||
@register.inclusion_tag('cards/sleep_last.html')
|
||||
def card_sleep_last(child):
|
||||
instance = Sleep.objects.filter(child=child).order_by('-end').first()
|
||||
return {'sleep': instance}
|
||||
|
|
Loading…
Reference in New Issue