From faaa67995fce58335c3923e0497bf4db9ac1348a Mon Sep 17 00:00:00 2001 From: Christopher Charbonneau Wells Date: Mon, 21 Aug 2017 19:53:21 -0400 Subject: [PATCH] Make the dashboard cards layout more opinionated. This puts all the "last" cards in one row consistently, assuming that the tummy time and diaper change cards should always have fairly large heights. The shifting heights were causing cards to appear in different places with the masonry setup. --- .../templates/cards/diaperchange_types.html | 2 +- dashboard/templates/dashboard/child.html | 26 ++++++++++++++----- dashboard/templatetags/dashboard.py | 2 +- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/dashboard/templates/cards/diaperchange_types.html b/dashboard/templates/cards/diaperchange_types.html index efc22496..7e058184 100644 --- a/dashboard/templates/cards/diaperchange_types.html +++ b/dashboard/templates/cards/diaperchange_types.html @@ -3,7 +3,7 @@ {% block header %}Diaper Changes{% endblock %} {% block title %} - Past 5 Days + Past Week {% endblock %} {% block content %} diff --git a/dashboard/templates/dashboard/child.html b/dashboard/templates/dashboard/child.html index 0f365336..9e56e92a 100644 --- a/dashboard/templates/dashboard/child.html +++ b/dashboard/templates/dashboard/child.html @@ -5,12 +5,24 @@ {% block content %}

{{ object }}

-
- {% card_feeding_last object %} - {% card_diaperchange_last object %} - {% card_tummytime_last object %} - {% card_tummytime_day object %} - {% card_sleep_last object %} - {% card_diaperchange_types object %} +
+
+
+
+ {% card_diaperchange_last object %} + {% card_feeding_last object %} +
+
+ {% card_tummytime_last object %} + {% card_sleep_last object %} +
+
+
+
+ {% card_tummytime_day object %} +
+
+ {% card_diaperchange_types object %} +
{% endblock %} \ No newline at end of file diff --git a/dashboard/templatetags/dashboard.py b/dashboard/templatetags/dashboard.py index eca3693b..6d1f4454 100644 --- a/dashboard/templatetags/dashboard.py +++ b/dashboard/templatetags/dashboard.py @@ -29,7 +29,7 @@ def card_diaperchange_last(child): def card_diaperchange_types(child): """Diaper change statistics for the last seven days including today.""" stats = OrderedDict() - for x in range(0, 5): + for x in range(0, 7): date = (timezone.now() - timezone.timedelta(days=x)).date() stats[date] = {'wet': 0, 'solid': 0}