From 4d7ac870e0bed7d62d243b90654185f86ab4ee9f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 2 May 2019 19:02:03 +1000 Subject: [PATCH] Use the collapse template for the stock location list view --- InvenTree/part/templates/part/category.html | 6 +-- .../part/templates/part/subcategories.html | 46 ++++++++----------- InvenTree/stock/templates/stock/location.html | 8 ++-- .../stock/templates/stock/location_list.html | 38 ++++++--------- 4 files changed, 41 insertions(+), 57 deletions(-) diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 3d514389bc..f199cc5981 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -33,9 +33,9 @@ -{% if category %} -{% include "part/subcategories.html" with children=category.children.all %} -{% else %} +{% if category and category.children.all|length > 0 %} +{% include "part/subcategories.html" with children=category.children.all collapse_id="children"%} +{% elif children|length > 0 %} {% include "part/subcategories.html" with children=children %} {% endif %}
diff --git a/InvenTree/part/templates/part/subcategories.html b/InvenTree/part/templates/part/subcategories.html index 5dcfa426ad..abf61d743e 100644 --- a/InvenTree/part/templates/part/subcategories.html +++ b/InvenTree/part/templates/part/subcategories.html @@ -1,27 +1,19 @@ -{% if children|length > 0 %} -
-
-
- -
-
-
    - {% for child in children %} -
  • - {{ child.name }} - {% if child.description %} - - {{ child.description }} - {% endif %} - {{ child.partcount }} -
  • - {% endfor %} -
-
-
-
-
-{% endif %} \ No newline at end of file +{% extends "collapse.html" %} + +{% block collapse_title %} +{{ children | length }} Child Categories +{% endblock %} + +{% block collapse_content %} + +{% endblock %} \ No newline at end of file diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 1483d8fc4f..76891ad4cd 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -31,10 +31,10 @@ -{% if location %} -{% include 'stock/location_list.html' with children=location.children.all %} -{% else %} -{% include 'stock/location_list.html' with children=locations %} +{% if location and location.children.all|length > 0 %} +{% include 'stock/location_list.html' with children=location.children.all collapse_id="locations" %} +{% elif locations|length > 0 %} +{% include 'stock/location_list.html' with children=locations collapse_id="locations" %} {% endif %}
diff --git a/InvenTree/stock/templates/stock/location_list.html b/InvenTree/stock/templates/stock/location_list.html index b906133e70..90d01c449c 100644 --- a/InvenTree/stock/templates/stock/location_list.html +++ b/InvenTree/stock/templates/stock/location_list.html @@ -1,23 +1,15 @@ -{% if children|length > 0 %} -
-
-
-
-

- Sub-Locations{{ children|length }} -

-
-
-
-
    - {% for child in children %} -
  • {{ child.name }} - {{ child.description }}
  • - {{ child.partcount }} - - {% endfor %} -
-
-
-
-
-{% endif %} \ No newline at end of file +{% extends "collapse.html" %} + +{% block collapse_title %} +Sub-Locations{{ children|length }} +{% endblock %} + +{% block collapse_content %} + +{% endblock %} \ No newline at end of file