zmiana month na m i poprawka w kolorach paginaci

This commit is contained in:
Mateusz Gruszczyński
2025-08-13 14:46:46 +02:00
parent ea5f9a3f27
commit 01fa938a27
2 changed files with 40 additions and 29 deletions

View File

@@ -33,19 +33,19 @@
{% set month_names = ["styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień",
"październik", "listopad", "grudzień"] %}
{% set selected_month = request.args.get('month') or now.strftime('%Y-%m') %}
{% set selected_month = selected_month or now.strftime('%Y-%m') %}
<!-- Pulpit: zwykły <select> -->
<div class="d-none d-md-flex justify-content-end align-items-center flex-wrap gap-2 mb-3">
<label for="monthSelect" class="text-white small mb-0">📅 Wybierz miesiąc:</label>
<select id="monthSelect" class="form-select form-select-sm bg-dark text-white border-secondary"
style="min-width: 180px;">
{% for offset in range(0, 6) %}
{% set d = (now - timedelta(days=offset * 30)) %}
{% set val = d.strftime('%Y-%m') %}
<option value="{{ val }}" {% if selected_month==val %}selected{% endif %}>
{{ month_names[d.month - 1] }} {{ d.year }}
</option>
style="min-width: 180px;"
onchange="window.location.search='?month='+this.value">
{% for m in month_options %}
{% set year, month = m.split('-') %}
<option value="{{ m }}" {% if selected_month == m %}selected{% endif %}>
{{ month_names[month|int - 1] }} {{ year }}
</option>
{% endfor %}
<option value="">Wyświetl wszystko</option>
</select>
@@ -58,6 +58,7 @@
</button>
</div>
{% if current_user.is_authenticated %}
<h3 class="mt-4 d-flex justify-content-between align-items-center flex-wrap">
Twoje listy
@@ -227,14 +228,16 @@
</div>
<div class="modal-body">
<div class="d-grid gap-2">
{% for offset in range(0, 6) %}
{% set d = (now - timedelta(days=offset * 30)) %}
{% set val = d.strftime('%Y-%m') %}
<a href="{{ url_for('main_page', month=val) }}" class="btn btn-outline-light">
{{ month_names[d.month - 1] }} {{ d.year }}
</a>
{% for m in month_options %}
{% set year, month = m.split('-') %}
<a href="{{ url_for('main_page', month=m) }}"
class="btn btn-outline-light {% if selected_month == m %}active{% endif %}">
{{ month_names[month|int - 1] }} {{ year }}
</a>
{% endfor %}
<a href="{{ url_for('main_page') }}" class="btn btn-outline-secondary">📋 Wyświetl wszystkie</a>
<a href="{{ url_for('main_page') }}" class="btn btn-outline-secondary {% if not selected_month %}active{% endif %}">
📋 Wyświetl wszystkie
</a>
</div>
</div>
</div>