Prep for adding breadcrumbs (WIP).

This commit is contained in:
Christopher Charbonneau Wells 2017-10-20 10:32:27 -04:00
parent 701a18199f
commit 0038a34843
7 changed files with 42 additions and 20 deletions

View File

@ -15,7 +15,7 @@
<link rel="stylesheet" href="{% static "babyblotter/css/vendor.min.css" %}" /> <link rel="stylesheet" href="{% static "babyblotter/css/vendor.min.css" %}" />
{% endif %} {% endif %}
</head> </head>
<body style="padding-top: 5rem;"> <body style="padding-top: 3rem;">
{% block nav %}{% endblock %} {% block nav %}{% endblock %}
{% block page %}{% endblock %} {% block page %}{% endblock %}

View File

@ -0,0 +1,9 @@
{{ path }}
<nav aria-label="breadcrumb" role="navigation">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#">Children</a></li>
<li class="breadcrumb-item">Fake</li>
<li class="breadcrumb-item active" aria-current="page">Dashboard</li>
</ol>
</nav>

View File

@ -1,5 +1,5 @@
{% extends 'babyblotter/base.html' %} {% extends 'babyblotter/base.html' %}
{% load timers %} {% load babyblotter timers %}
{% block nav %} {% block nav %}
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
@ -153,4 +153,7 @@
{% endif %} {% endif %}
</div> </div>
</nav> </nav>
{% breadcrumbs %}
{% endblock %} {% endblock %}

View File

View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template
register = template.Library()
@register.inclusion_tag('babyblotter/breadcrumbs.html', takes_context=True)
def breadcrumbs(context):
request = context['request'] or None
# TODO: Process path and send breadcrumbs down.
return {'path': request.path}

View File

@ -2,7 +2,7 @@
{% block title %} {% block title %}
{% if request.resolver_match.url_name == 'child-update' %} {% if request.resolver_match.url_name == 'child-update' %}
Update a Child {{ object }}
{% else %} {% else %}
Add a Child Add a Child
{% endif %} {% endif %}

View File

@ -5,23 +5,19 @@
{% block content %} {% block content %}
<div class="rounded text-center pb-2"> <div class="dropdown">
<h1 class="display-4">{{ object }}</h1> <button id="reports-dropdown"
class="btn btn-success dropdown-toggle"
<div class="dropdown"> type="button"
<button id="reports-dropdown" data-toggle="dropdown"
class="btn btn-success dropdown-toggle" aria-haspopup="true"
type="button" aria-expanded="false"><i class="icon icon-graph" aria-hidden="true"></i> Reports</button>
data-toggle="dropdown" <div class="dropdown-menu" aria-labelledby="reports-dropdown">
aria-haspopup="true" <a class="dropdown-item" href="{% url 'reports:report-diaperchange-types-child' object.slug %}">Diaper Change Types</a>
aria-expanded="false"><i class="icon icon-graph" aria-hidden="true"></i> Reports</button> <a class="dropdown-item" href="{% url 'reports:report-diaperchange-lifetimes-child' object.slug %}">Diaper Lifetimes</a>
<div class="dropdown-menu" aria-labelledby="reports-dropdown"> <a class="dropdown-item" href="{% url 'reports:report-sleep-pattern-child' object.slug %}">Sleep Pattern</a>
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-types-child' object.slug %}">Diaper Change Types</a> <a class="dropdown-item" href="{% url 'reports:report-sleep-totals-child' object.slug %}">Sleep Totals</a>
<a class="dropdown-item" href="{% url 'reports:report-diaperchange-lifetimes-child' object.slug %}">Diaper Lifetimes</a> <a class="dropdown-item" href="{% url 'reports:report-timeline-child' object.slug %}">Timeline</a>
<a class="dropdown-item" href="{% url 'reports:report-sleep-pattern-child' object.slug %}">Sleep Pattern</a>
<a class="dropdown-item" href="{% url 'reports:report-sleep-totals-child' object.slug %}">Sleep Totals</a>
<a class="dropdown-item" href="{% url 'reports:report-timeline-child' object.slug %}">Timeline</a>
</div>
</div> </div>
</div> </div>