diff --git a/argocd/deployment.yaml b/argocd/deployment.yaml index df0ba34..13049e4 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.027 + image: git.baumann.gr/adebaumann/labhelper:0.028 imagePullPolicy: Always ports: - containerPort: 8000 diff --git a/boxes/templates/boxes/add_things.html b/boxes/templates/boxes/add_things.html index 5b931a9..93244f5 100644 --- a/boxes/templates/boxes/add_things.html +++ b/boxes/templates/boxes/add_things.html @@ -1,213 +1,128 @@ - - - - - - Add Things to Box {{ box.id }} - LabHelper - - - - ← Home +{% extends "base.html" %} + +{% block title %}Add Things to Box {{ box.id }} - LabHelper{% endblock %} + +{% block page_header %} + +{% endblock %} + +{% block content %} +
+
+ + Box: {{ box.id }} ({{ box.box_type.name }}) + +
-

Add Things to Box {{ box.id }}

- -
-

- Box: {{ box.id }} ({{ box.box_type.name }}) -

- - {% if formset.non_form_errors %} -
- {% for form_errors in formset.non_form_errors %} - {% for field, errors in form_errors.items %} - {% for error in errors %} -
  • {{ error }}
  • - {% endfor %} + {% if formset.non_form_errors %} +
    + + {% for form_errors in formset.non_form_errors %} + {% for field, errors in form_errors.items %} + {% for error in errors %} + {{ error }} {% endfor %} {% endfor %} -
    - {% endif %} - - {% if formset.total_form_count %} -
    - {% csrf_token %} - - - - - - - + {% endfor %} + + {% endif %} + + {% if success_message %} +
    + {{ success_message }} +
    + {% endif %} + + {% if formset.total_form_count %} + + {% csrf_token %} +
    NameTypeDescriptionPicture
    + + + + + + + - {{ formset.management_form }} - {% for form in formset %} - - - + {{ formset.management_form }} + {% for form in formset %} + + + - + - + - + - - {% endfor %} - - - -
    NameTypeDescriptionPicture
    - {{ form.id }} - +
    + {{ form.id }} + +
    {{ form.name }} {% for error in form.name.errors %} -
    -
  • {{ error }}
  • +
    + {{ error }}
    {% endfor %} - -
    + * + + +
    {{ form.thing_type }} {% for error in form.thing_type.errors %} -
    -
  • {{ error }}
  • +
    + {{ error }}
    {% endfor %} - -
    + * + + +
    {{ form.description }} {% for error in form.description.errors %} -
    -
  • {{ error }}
  • +
    + {{ error }}
    {% endfor %} -
    + + +
    {{ form.picture }} {% for error in form.picture.errors %} -
    -
  • {{ error }}
  • +
    + {{ error }}
    {% endfor %} -
    - -
    -
    - {% endif %} +
    + + + {% endfor %} + - {% if success_message %} -
    - {{ success_message }} +
    +
    - {% endif %} -
    - - + + {% endif %} +
    +{% endblock %} + +{% block extra_js %} + +{% endblock %} \ No newline at end of file diff --git a/boxes/templates/boxes/box_detail.html b/boxes/templates/boxes/box_detail.html index 5a1fde7..9f53664 100644 --- a/boxes/templates/boxes/box_detail.html +++ b/boxes/templates/boxes/box_detail.html @@ -1,122 +1,90 @@ +{% extends "base.html" %} {% load thumbnail %} - - - - - - Box {{ box.id }} - LabHelper - - - - ← Back to Home - -

    Box {{ box.id }}

    - -
    - Type: {{ box.box_type.name }} - ({{ box.box_type.width }} x {{ box.box_type.height }} x {{ box.box_type.length }} mm) -

    - + Add Things + +{% block title %}Box {{ box.id }} - LabHelper{% endblock %} + +{% block page_header %} + +{% endblock %} + +{% block content %} +
    +
    +
    +
    + Type: {{ box.box_type.name }} +
    +
    + {{ box.box_type.width }} x {{ box.box_type.height }} x {{ box.box_type.length }} mm +
    +
    + + Add Things +
    - - {% if things %} - - - - - - - - - - - {% for thing in things %} - - - - - - - {% endfor %} - -
    PictureNameTypeDescription
    - {% if thing.picture %} - {% thumbnail thing.picture "50x50" crop="center" as thumb %} - {{ thing.name }} - {% endthumbnail %} - {% else %} -
    No image
    - {% endif %} -
    {{ thing.name }}{{ thing.thing_type.name }}{{ thing.description|default:"-" }}
    - {% else %} -
    - This box is empty. +
    + +{% if things %} +
    +
    + + + + + + + + + + + {% for thing in things %} + + + + + + + {% endfor %} + +
    PictureNameTypeDescription
    + {% if thing.picture %} + {% thumbnail thing.picture "50x50" crop="center" as thumb %} + {{ thing.name }} + {% endthumbnail %} + {% else %} +
    No image
    + {% endif %} +
    + {{ thing.name }} + {{ thing.thing_type.name }}{{ thing.description|default:"-" }}
    - {% endif %} - - +
    +{% else %} +
    + +

    This box is empty

    +

    Add some items to get started!

    + + Add Things + +
    +{% endif %} +{% endblock %} + +{% block extra_js %} + +{% endblock %} \ No newline at end of file diff --git a/boxes/templates/boxes/index.html b/boxes/templates/boxes/index.html index 5fc532c..664a3ce 100644 --- a/boxes/templates/boxes/index.html +++ b/boxes/templates/boxes/index.html @@ -1,205 +1,103 @@ +{% extends "base.html" %} {% load mptt_tags %} - - - - - - LabHelper - - - - - -
    -

    LabHelper

    - - - -
    -

    Boxes

    - {% if boxes %} -
    - {% for box in boxes %} -
    - -
    Box {{ box.id }}
    -
    {{ box.box_type.name }}
    -
    - {{ box.box_type.width }} x {{ box.box_type.height }} x {{ box.box_type.length }} mm -
    -
    - {{ box.things.count }} item{{ box.things.count|pluralize }} -
    -
    + +{% block title %}LabHelper - Home{% endblock %} + +{% block page_header %} + +{% endblock %} + +{% block content %} +
    +

    Boxes

    + {% if boxes %} + - -
    -

    Thing Types

    - {% if thing_types %} -
    - {% else %} -

    No thing types found.

    - {% endif %} +
    + {{ box.box_type.name }} +
    +
    + {{ box.box_type.width }} x {{ box.box_type.height }} x {{ box.box_type.length }} mm +
    +
    + {{ box.things.count }} item{{ box.things.count|pluralize }} +
    +
    + {% endfor %}
    - - \ No newline at end of file + {% else %} +

    + + No boxes found. +

    + {% endif %} +
    + +
    +

    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 %} +
    +{% endblock %} + +{% block extra_js %} + +{% endblock %} \ No newline at end of file diff --git a/boxes/templates/boxes/search.html b/boxes/templates/boxes/search.html index 15eef14..16e4389 100644 --- a/boxes/templates/boxes/search.html +++ b/boxes/templates/boxes/search.html @@ -1,187 +1,125 @@ - - - - - - Search - LabHelper - - - - ← Back to Home +{% extends "base.html" %} + +{% block title %}Search - LabHelper{% endblock %} + +{% block page_header %} + +{% endblock %} + +{% block content %} +
    + +

    + Type at least 2 characters to search +

    +
    -

    Search Things

    - -
    - -
    Type at least 2 characters to search
    -
    - -
    - +
    - - - - - + + + + +
    NameTypeBoxDescription
    NameTypeBoxDescription
    +
    - + +{% endblock %} - - - + row.addEventListener('mouseleave', function() { + this.style.background = 'white'; + }); + + resultsBody.appendChild(row); + }); + }); + }, 200); +}); + +searchInput.addEventListener('blur', function() { + searchInput.style.borderColor = '#e0e0e0'; + searchInput.style.boxShadow = 'none'; +}); + +function escapeHtml(text) { + const div = document.createElement('div'); + div.textContent = text; + return div.innerHTML; +} + +searchInput.focus(); + +{% endblock %} \ No newline at end of file diff --git a/boxes/templates/boxes/thing_detail.html b/boxes/templates/boxes/thing_detail.html index a8c7825..20fdfd3 100644 --- a/boxes/templates/boxes/thing_detail.html +++ b/boxes/templates/boxes/thing_detail.html @@ -1,185 +1,103 @@ +{% extends "base.html" %} {% load thumbnail %} - - - - - - {{ thing.name }} - LabHelper - - - - - -

    {{ thing.name }}

    - -
    -
    + +{% block title %}{{ thing.name }} - LabHelper{% endblock %} + +{% block page_header %} + +{% endblock %} + +{% block content %} +
    +
    +
    {% if thing.picture %} - {% thumbnail thing.picture "300x300" crop="center" as thumb %} - {{ thing.name }} + {% thumbnail thing.picture "400x400" crop="center" as thumb %} + {{ thing.name }} {% endthumbnail %} {% else %} -
    No image
    +
    +
    + + No image +
    +
    {% endif %}
    -
    -
    -
    Type
    -
    {{ thing.thing_type.name }}
    +
    +
    +
    + Type +
    +
    + {{ thing.thing_type.name }} +
    -
    -
    Location
    -
    - Box {{ thing.box.id }} - ({{ thing.box.box_type.name }}) +
    +
    + Location +
    +
    + Box {{ thing.box.id }} + ({{ thing.box.box_type.name }})
    {% if thing.description %} -
    -
    Description
    -
    {{ thing.description }}
    +
    +
    + Description +
    +
    + {{ thing.description }} +
    {% endif %} -
    - -
    - {% csrf_token %} - - - -
    - - +
    + +
    + {% csrf_token %} +
    +
    + + +
    + +
    +
    + +{% endblock %} + +{% block extra_js %} + +{% endblock %} \ No newline at end of file diff --git a/boxes/templates/boxes/thing_type_detail.html b/boxes/templates/boxes/thing_type_detail.html index 7652710..3f2bcb7 100644 --- a/boxes/templates/boxes/thing_type_detail.html +++ b/boxes/templates/boxes/thing_type_detail.html @@ -1,183 +1,106 @@ +{% extends "base.html" %} {% load thumbnail %} - - - - - - {{ thing_type.name }} - LabHelper - - - - ← Home - -

    {{ thing_type.name }}

    - -
    - {% if thing_type.parent %} - - {% endif %} - {% if thing_type.children.exists %} -
    - Subtypes: - {% for child in thing_type.children.all %} - {{ child.name }} - {% endfor %} -
    - {% endif %} + +{% block title %}{{ thing_type.name }} - LabHelper{% endblock %} + +{% block page_header %} + +{% endblock %} + +{% block content %} +
    + {% if thing_type.parent %} + + {% endif %} - {% if things_by_type %} - {% for subtype, things in things_by_type.items %} -
    -

    {{ subtype.name }}

    - {% if things %} - + {% if thing_type.children.exists %} +
    + + Subtypes: + {% for child in thing_type.children.all %} + {{ child.name }} + {% endfor %} + +
    + {% endif %} + + +{% if things_by_type %} +{% for subtype, things in things_by_type.items %} +
    +

    {{ subtype.name }}

    + {% if things %} +
    +
    - - - - - + + + + + {% for thing in things %} - - + - - - + {% endfor %}
    PictureNameBoxDescription
    PictureNameBoxDescription
    +
    {% if thing.picture %} {% thumbnail thing.picture "50x50" crop="center" as thumb %} - {{ thing.name }} + {{ thing.name }} {% endthumbnail %} {% else %} -
    No image
    +
    No image
    {% endif %}
    - {{ thing.name }} + + {{ thing.name }} - Box {{ thing.box.id }} -
    {{ thing.box.box_type.name }} +
    + Box {{ thing.box.id }} +
    {{ thing.box.box_type.name }}
    {{ thing.description|default:"-" }}{{ thing.description|default:"-" }}
    - {% else %} -
    No things in this category
    - {% endif %}
    - {% endfor %} {% else %} -
    -
    No things found in this category or its subcategories
    +
    + + No things in this category
    {% endif %} - - \ No newline at end of file +
    +{% endfor %} +{% else %} +
    + +

    No things found

    +

    This category or its subcategories are empty.

    +
    +{% endif %} +{% endblock %} + +{% block extra_js %} + +{% endblock %} \ No newline at end of file diff --git a/data/media/cache/60/d1/60d1bb6c53ee06eb26d4708f19b149d9.jpg b/data/media/cache/60/d1/60d1bb6c53ee06eb26d4708f19b149d9.jpg new file mode 100644 index 0000000..f7940f6 Binary files /dev/null and b/data/media/cache/60/d1/60d1bb6c53ee06eb26d4708f19b149d9.jpg differ diff --git a/data/media/cache/71/d0/71d025fefc5668ca6b1ff83985afe6ec.jpg b/data/media/cache/71/d0/71d025fefc5668ca6b1ff83985afe6ec.jpg new file mode 100644 index 0000000..21c1ba4 Binary files /dev/null and b/data/media/cache/71/d0/71d025fefc5668ca6b1ff83985afe6ec.jpg differ diff --git a/data/media/cache/8b/16/8b1685afb6011f553aa30d3992f9624d.jpg b/data/media/cache/8b/16/8b1685afb6011f553aa30d3992f9624d.jpg new file mode 100644 index 0000000..a8e939e Binary files /dev/null and b/data/media/cache/8b/16/8b1685afb6011f553aa30d3992f9624d.jpg differ diff --git a/labhelper/settings.py b/labhelper/settings.py index 6ab1e5d..eb02e7c 100644 --- a/labhelper/settings.py +++ b/labhelper/settings.py @@ -59,7 +59,7 @@ ROOT_URLCONF = 'labhelper.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [BASE_DIR / 'labhelper' / 'templates'], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/labhelper/templates/base.html b/labhelper/templates/base.html new file mode 100644 index 0000000..8f0702d --- /dev/null +++ b/labhelper/templates/base.html @@ -0,0 +1,247 @@ +{% load static %} + + + + + + {% block title %}LabHelper{% endblock %} + + + + {% block extra_head %}{% endblock %} + + + + +
    + {% block page_header %}{% endblock %} + + {% block content %}{% endblock %} +
    + + + + {% block extra_js %}{% endblock %} + + \ No newline at end of file