mirror of https://github.com/snachodog/mybuddy.git
🚸 adds a child quick switch in breadcrumb
This quick switch is available in dashboard, timeline and reports breadcrumbs and allows to quickly switch to the "same" page but for another child
This commit is contained in:
parent
0d26efe05a
commit
0cd989ff96
|
@ -1,11 +1,13 @@
|
|||
{% extends 'babybuddy/page.html' %}
|
||||
{% load duration i18n imagekit static %}
|
||||
{% load breadcrumb duration i18n imagekit static %}
|
||||
|
||||
{% block title %}{{ object }}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{% url 'core:child-list' %}">{% trans "Children" %}</a></li>
|
||||
<li class="breadcrumb-item font-weight-bold">{{ object }}</li>
|
||||
<li class="breadcrumb-item font-weight-bold">
|
||||
{% child_quick_switch object 'core:child' %}
|
||||
</li>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{% load i18n %}
|
||||
|
||||
<a href="{% url 'core:child' current_child.slug %}">{{ current_child }}</a>
|
||||
{% if children.count > 0 %}
|
||||
<a href="#" class="ml-1 pl-1 pr-1 btn btn-xs btn-outline-light dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="sr-only">{% trans 'Switch child' %}</span>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<h6 class="dropdown-header">{% trans "Switch to…" %}</h6>
|
||||
{% for child in children %}
|
||||
<a class="dropdown-item d-flex align-items-center" href="{% url target_url child.slug %}">
|
||||
{% include "core/child_thumbnail.html" %}
|
||||
<span class="text-wrap ml-2">{{ child }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
|
@ -0,0 +1,16 @@
|
|||
from django import template
|
||||
|
||||
from core.models import Child
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.inclusion_tag("core/child_quick_switch.html")
|
||||
def child_quick_switch(current_child, target_url):
|
||||
children = Child.objects.exclude(slug=current_child.slug)
|
||||
|
||||
return {
|
||||
"children": children,
|
||||
"current_child": current_child,
|
||||
"target_url": target_url,
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
{% extends 'babybuddy/page.html' %}
|
||||
{% load cards i18n %}
|
||||
{% load breadcrumb cards i18n %}
|
||||
|
||||
{% block title %}{% trans "Dashboard" %} - {{ object }}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{% url 'core:child-list' %}">{% trans "Children" %}</a></li>
|
||||
<li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:child' object.slug %}">{{ object }}</a></li>
|
||||
<li class="breadcrumb-item font-weight-bold">
|
||||
{% child_quick_switch object 'dashboard:dashboard-child' %}
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Dashboard" %}</li>
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -5,6 +5,4 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
<li class="breadcrumb-item"><a href="{% url 'core:child-list' %}">{% trans "Children" %}</a></li>
|
||||
<li class="breadcrumb-item font-weight-bold"><a href="{% url 'core:child' object.slug %}">{{ object }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'reports:report-list' object.slug %}">{% trans "Reports" %}</a></li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-bmi-change-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "BMI" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{% load breadcrumb i18n %}
|
||||
|
||||
<li class="breadcrumb-item font-weight-bold">
|
||||
{% child_quick_switch object target_url %}
|
||||
</li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'reports:report-list' object.slug %}">{% trans "Reports" %}</a></li>
|
||||
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-diaperchange-amounts-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Diaper Amounts" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-diaperchange-lifetimes-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Diaper Lifetimes" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-diaperchange-types-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Diaper Change Types" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-feeding-amounts-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Feeding Amounts" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-feeding-duration-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Average Feeding Durations" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-head-circumference-change-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Head Circumference" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-height-change-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Height" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-pumping-amounts-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Pumping" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
{% extends 'reports/base.html' %}
|
||||
{% load i18n static %}
|
||||
{% load breadcrumb i18n static %}
|
||||
|
||||
{% block title %}{% trans "Reports" %} - {{ object }}{% endblock %}
|
||||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
<li class="breadcrumb-item font-weight-bold">
|
||||
{% child_quick_switch object 'reports:report-list' %}
|
||||
</li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Reports" %}</li>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container-fluid">
|
||||
<h1>Reports</h1>
|
||||
|
@ -22,4 +31,4 @@
|
|||
<a href="{% url 'reports:report-weight-change-child' object.slug %}" class="list-group-item list-group-item-action">{% trans "Weight" %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-sleep-pattern-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Sleep Pattern" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-sleep-totals-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Sleep Totals" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-tummy-time-duration-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Total Tummy Time Durations" %}</li>
|
||||
{% endblock %}
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
{% block breadcrumbs %}
|
||||
{{ block.super }}
|
||||
{% include 'reports/breadcrumb_common_chunk.html' with target_url='reports:report-weight-change-child' %}
|
||||
<li class="breadcrumb-item active" aria-current="page">{% trans "Weight" %}</li>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue