diff --git a/storage/templates/item.html b/storage/templates/item.html index 2468bc5..b5f5a88 100644 --- a/storage/templates/item.html +++ b/storage/templates/item.html @@ -16,31 +16,14 @@
- {% if labels %} -

Labels

- - {% for label in labels %} -
-
- {% csrf_token %} - -
-
- {% csrf_token %} - - {{ label.id }} -
-
- {% endfor %} - {% endif %} - -

Details

{% if item.owner %} {% endif %} + {% if item.state != "present" %} + {% endif %} {% if item.taken_by %} {% endif %} @@ -53,9 +36,30 @@ {% endif %} - + +
owner{{ item.owner }}
state{{ item.state }}
taken by{{ item.taken_by }}
taken until{{ item.taken_until }}
pk{{ item.pk }}
+ {% if labels and not has_one_label %} +

Labels

+ {% endif %} + + {% for label in labels %} +
+
+ {% csrf_token %} + +
+
+ {% csrf_token %} + + {% if not has_one_label %} + {{ label.id }} + {% endif %} +
+
+ {% endfor %} + {% if item.props.items %}

Properties

diff --git a/storage/views.py b/storage/views.py index 674e2b2..ccc3172 100644 --- a/storage/views.py +++ b/storage/views.py @@ -80,12 +80,16 @@ def item_display(request, pk): }) item = get_object_or_404(Item, pk=pk) + labels = item.labels.all() + has_one_label = len(labels) == 1 + return render(request, 'item.html', { 'item': item, 'categories': item.categories.all(), 'props': sorted(item.props.items()), 'images': item.images.all(), - 'labels': item.labels.all(), + 'labels': labels, + 'has_one_label': has_one_label, 'history': LogEntry.objects.filter(object_id=item.pk), 'ancestors': item.get_ancestors(), 'children': item.get_children().prefetch_related('categories'), diff --git a/templates/base.html b/templates/base.html index 6e5eef6..d322ab2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -20,14 +20,14 @@ - spejstore + Hackerspace Storage System
+ + {% if item %} + + {% endif %} + {% for item in list %} - {% endif %} + + + Add child + + + {% endif %}
+ + + Add child + +
@@ -29,10 +39,10 @@ {% if item %}
- - - Add child - -