From 02e949d0ad55b1a3c724dc20eb4eeefb1dd99fb9 Mon Sep 17 00:00:00 2001 From: "Adrian A. Baumann" Date: Mon, 29 Dec 2025 00:09:23 +0100 Subject: [PATCH] Add new front page with boxes and thing types tree - Replace simple HTML index with full template - Add grid of all boxes with details and item counts - Add expandable tree view of thing types using MPTT - Add 'mptt' to INSTALLED_APPS for recursetree tag - Add jQuery for tree toggle functionality Bump container version to 0.027 --- argocd/deployment.yaml | 2 +- boxes/templates/boxes/index.html | 205 +++++++++++++++++++++++++++++++ boxes/views.py | 10 +- labhelper/settings.py | 1 + 4 files changed, 214 insertions(+), 4 deletions(-) create mode 100644 boxes/templates/boxes/index.html diff --git a/argocd/deployment.yaml b/argocd/deployment.yaml index c757ea7..df0ba34 100644 --- a/argocd/deployment.yaml +++ b/argocd/deployment.yaml @@ -27,7 +27,7 @@ spec: mountPath: /data containers: - name: web - image: git.baumann.gr/adebaumann/labhelper:0.026 + image: git.baumann.gr/adebaumann/labhelper:0.027 imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/boxes/templates/boxes/index.html b/boxes/templates/boxes/index.html new file mode 100644 index 0000000..5fc532c --- /dev/null +++ b/boxes/templates/boxes/index.html @@ -0,0 +1,205 @@ +{% load mptt_tags %} + + + + + + LabHelper + + + + + +
+

LabHelper

+ + + + + +
+

Thing Types

+ {% if thing_types %} +
    + {% recursetree thing_types %} +
  • + {% if children %} + [-] + {% else %} +   + {% endif %} + {{ node.name }} + {% if node.things.exists %} + ({{ node.things.count }}) + {% endif %} + {% if children %} +
      + {{ children }} +
    + {% endif %} +
  • + {% endrecursetree %} +
+ {% else %} +

No thing types found.

+ {% endif %} +
+
+ + \ No newline at end of file diff --git a/boxes/views.py b/boxes/views.py index a9792f1..49727c8 100644 --- a/boxes/views.py +++ b/boxes/views.py @@ -6,9 +6,13 @@ from .models import Box, Thing, ThingType def index(request): - """Simple index page.""" - html = '

LabHelper

Search Things | Admin

' - return HttpResponse(html) + """Home page with boxes and thing types.""" + boxes = Box.objects.select_related('box_type').all().order_by('id') + thing_types = ThingType.objects.all() + return render(request, 'boxes/index.html', { + 'boxes': boxes, + 'thing_types': thing_types, + }) def box_detail(request, box_id): diff --git a/labhelper/settings.py b/labhelper/settings.py index 9a9dadb..6ab1e5d 100644 --- a/labhelper/settings.py +++ b/labhelper/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'mptt', 'django_mptt_admin', 'sorl.thumbnail', 'boxes',