From b5cdda54f811dcf51fe74a6f38d5ccbe1be0f397 Mon Sep 17 00:00:00 2001 From: Stephan Kerkman Date: Sun, 31 May 2026 13:11:22 +0200 Subject: [PATCH] feat: location filter, mobile overflow fixes, card scan icon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace indoor/outdoor filter with dynamic location buttons - Fix pruning strip date/badge overflow on narrow screens (flex-shrink-0, gap-2, text-nowrap, flex-wrap) - Fix pruning calendar badges compressing on long plant names - Re-add pruning strip to plant detail (was missing) - Change card scan nav icon from 📷 to 🪪 Co-Authored-By: Claude Sonnet 4.6 --- plants/templates/plants/base.html | 2 +- .../plants/partials/plant_list_results.html | 1 - .../plants/partials/pruning_strip.html | 8 +++++--- plants/templates/plants/plant_detail.html | 4 ++++ plants/templates/plants/plant_list.html | 9 +++++---- plants/templates/plants/pruning_calendar.html | 6 +++--- plants/views/plants.py | 17 ++++++++++------- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/plants/templates/plants/base.html b/plants/templates/plants/base.html index 5131af7..d226393 100644 --- a/plants/templates/plants/base.html +++ b/plants/templates/plants/base.html @@ -30,7 +30,7 @@ 🌸 BloomBase diff --git a/plants/templates/plants/partials/plant_list_results.html b/plants/templates/plants/partials/plant_list_results.html index f6c84d2..898e049 100644 --- a/plants/templates/plants/partials/plant_list_results.html +++ b/plants/templates/plants/partials/plant_list_results.html @@ -13,7 +13,6 @@
{{ plant.name }}
{{ plant.location }} - · {% if plant.is_indoor %}Indoor{% else %}Outdoor{% endif %} diff --git a/plants/templates/plants/partials/pruning_strip.html b/plants/templates/plants/partials/pruning_strip.html index 9cd5885..0a95998 100644 --- a/plants/templates/plants/partials/pruning_strip.html +++ b/plants/templates/plants/partials/pruning_strip.html @@ -1,6 +1,6 @@ {% load plant_extras %}
-
+
✂️ Pruning {% if plant.pruning_months %} @@ -8,15 +8,17 @@ {% endif %} {% with plant.pruning_logs.first as last_log %} {% if last_log %} -
Last pruned: {{ last_log.pruned_on|date:"j M Y" }}
+
Last pruned: {{ last_log.pruned_on|date:"j M Y" }}
{% endif %} {% endwith %}
+
{% if pruning_status == 'overdue' %} Overdue {% elif pruning_status == 'due_this_month' %} Due this month {% endif %} +
{% csrf_token %} -
+
{{ log_form.pruned_on }}
diff --git a/plants/templates/plants/plant_detail.html b/plants/templates/plants/plant_detail.html index 1b35f95..171a028 100644 --- a/plants/templates/plants/plant_detail.html +++ b/plants/templates/plants/plant_detail.html @@ -85,6 +85,10 @@
{% endif %} +{% if plant.pruning_months %} +{% include "plants/partials/pruning_strip.html" %} +{% endif %} + diff --git a/plants/templates/plants/plant_list.html b/plants/templates/plants/plant_list.html index b5284e3..0a89c55 100644 --- a/plants/templates/plants/plant_list.html +++ b/plants/templates/plants/plant_list.html @@ -15,10 +15,11 @@ >
-
- All - Indoor - Outdoor +
+ All + {% for loc in locations %} + {{ loc.name }} + {% endfor %}
diff --git a/plants/templates/plants/pruning_calendar.html b/plants/templates/plants/pruning_calendar.html index 1600d3e..083047a 100644 --- a/plants/templates/plants/pruning_calendar.html +++ b/plants/templates/plants/pruning_calendar.html @@ -12,7 +12,7 @@
{{ plant.name }}
{{ plant.location }}
- Overdue + Overdue {% endfor %}
@@ -27,7 +27,7 @@
{{ plant.name }}
{{ plant.location }}
- This month + This month {% endfor %} @@ -42,7 +42,7 @@
{{ plant.name }}
{{ plant.location }} - {{ next_month_name }} + {{ next_month_name }} {% endfor %} diff --git a/plants/views/plants.py b/plants/views/plants.py index b74702b..8569e3f 100644 --- a/plants/views/plants.py +++ b/plants/views/plants.py @@ -2,7 +2,7 @@ from datetime import date from django.shortcuts import render, get_object_or_404, redirect from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.http import require_POST, require_GET -from plants.models import Plant, Species, PruningLog, PlantPhoto, PlantCardPhoto +from plants.models import Plant, Species, PruningLog, PlantPhoto, PlantCardPhoto, Location from plants.forms import PlantForm, PruningLogForm from plants.utils.pruning import pruning_status @@ -10,21 +10,24 @@ from plants.utils.pruning import pruning_status def plant_list(request): qs = Plant.objects.select_related('species', 'location').prefetch_related('photos').all() q = request.GET.get('q', '') - indoor_filter = request.GET.get('filter', '') + location_filter = request.GET.get('location', '') if q: qs = qs.filter(name__icontains=q) | qs.filter(location__name__icontains=q) - if indoor_filter == 'indoor': - qs = qs.filter(is_indoor=True) - elif indoor_filter == 'outdoor': - qs = qs.filter(is_indoor=False) + if location_filter: + qs = qs.filter(location__pk=location_filter) + locations = Location.objects.all() template = ( 'plants/partials/plant_list_results.html' if request.htmx else 'plants/plant_list.html' ) - return render(request, template, {'plants': qs, 'q': q, 'filter': indoor_filter}) + return render(request, template, { + 'plants': qs, 'q': q, + 'location_filter': location_filter, + 'locations': locations, + }) def plant_detail(request, pk):