mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-23 00:58:40 +02:00
@@ -91,6 +91,12 @@ def month_year_picker(request):
|
|||||||
for date in all_months
|
for date in all_months
|
||||||
]
|
]
|
||||||
|
|
||||||
|
today_url = (
|
||||||
|
reverse(url, kwargs={"month": current_date.month, "year": current_date.year})
|
||||||
|
if url
|
||||||
|
else ""
|
||||||
|
)
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"common/fragments/month_year_picker.html",
|
"common/fragments/month_year_picker.html",
|
||||||
@@ -98,6 +104,7 @@ def month_year_picker(request):
|
|||||||
"month_year_data": result,
|
"month_year_data": result,
|
||||||
"current_month": current_month,
|
"current_month": current_month,
|
||||||
"current_year": current_year,
|
"current_year": current_year,
|
||||||
|
"today_url": today_url,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,47 +5,51 @@
|
|||||||
{% block title %}{% translate 'Pick a month' %}{% endblock %}
|
{% block title %}{% translate 'Pick a month' %}{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
{% regroup month_year_data by year as years_list %}
|
{% regroup month_year_data by year as years_list %}
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-fill" id="yearTabs" role="tablist">
|
<ul class="nav nav-pills nav-fill" id="yearTabs" role="tablist">
|
||||||
{% for x in years_list %}
|
{% for x in years_list %}
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link{% if x.grouper == current_year %} active{% endif %}"
|
<button class="nav-link{% if x.grouper == current_year %} active{% endif %}"
|
||||||
id="{{ x.grouper }}"
|
id="{{ x.grouper }}"
|
||||||
data-bs-toggle="tab"
|
data-bs-toggle="tab"
|
||||||
data-bs-target="#{{ x.grouper }}-pane"
|
data-bs-target="#{{ x.grouper }}-pane"
|
||||||
type="button"
|
type="button"
|
||||||
role="tab"
|
role="tab"
|
||||||
aria-controls="{{ x.grouper }}-pane"
|
aria-controls="{{ x.grouper }}-pane"
|
||||||
aria-selected="{% if x.grouper == current_year %}true{% else %}false{% endif %}">
|
aria-selected="{% if x.grouper == current_year %}true{% else %}false{% endif %}">
|
||||||
{{ x.grouper }}
|
{{ x.grouper }}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<div class="tab-content" id="yearTabsContent" hx-boost="true">
|
|
||||||
{% for x in years_list %}
|
|
||||||
<div class="tab-pane fade{% if x.grouper == current_year %} show active{% endif %} mt-2"
|
|
||||||
id="{{ x.grouper }}-pane"
|
|
||||||
role="tabpanel"
|
|
||||||
aria-labelledby="{{ x.grouper }}"
|
|
||||||
tabindex="0">
|
|
||||||
<ul class="list-group list-group-flush" id="month-year-list">
|
|
||||||
{% for month_data in x.list %}
|
|
||||||
<li class="list-group-item tw:hover:bg-zinc-900
|
|
||||||
{% if month_data.month == current_month and month_data.year == current_year %} disabled bg-primary{% endif %}"
|
|
||||||
{% if month_data.month == current_month and month_data.year == current_year %}aria-disabled="true"{% endif %}>
|
|
||||||
<div class="d-flex justify-content-between">
|
|
||||||
<a class="text-decoration-none stretched-link {% if month_data.month == current_month and month_data.year == current_year %} text-black{% endif %}"
|
|
||||||
href={{ month_data.url }}>
|
|
||||||
{{ month_data.month|month_name }}</a>
|
|
||||||
<span class="badge text-bg-secondary">{{ month_data.transaction_count }}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
<div class="tab-content" id="yearTabsContent" hx-boost="true">
|
||||||
|
{% for x in years_list %}
|
||||||
|
<div class="tab-pane fade{% if x.grouper == current_year %} show active{% endif %} mt-2"
|
||||||
|
id="{{ x.grouper }}-pane"
|
||||||
|
role="tabpanel"
|
||||||
|
aria-labelledby="{{ x.grouper }}"
|
||||||
|
tabindex="0">
|
||||||
|
<ul class="list-group list-group-flush" id="month-year-list">
|
||||||
|
{% for month_data in x.list %}
|
||||||
|
<li class="list-group-item tw:hover:bg-zinc-900
|
||||||
|
{% if month_data.month == current_month and month_data.year == current_year %} disabled bg-primary{% endif %}"
|
||||||
|
{% if month_data.month == current_month and month_data.year == current_year %}aria-disabled="true"{% endif %}>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<a class="text-decoration-none stretched-link {% if month_data.month == current_month and month_data.year == current_year %} text-black{% endif %}"
|
||||||
|
href={{ month_data.url }}>
|
||||||
|
{{ month_data.month|month_name }}</a>
|
||||||
|
<span class="badge text-bg-secondary">{{ month_data.transaction_count }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="w-full text-end">
|
||||||
|
<a class="btn btn-outline-primary btn-sm" href="{{ today_url }}" role="button" hx-boost="true">{% trans 'Today' %}</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user