From ef674061deb2342472f8aeb2e4e602e006caeb2e Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 29 Aug 2019 15:50:48 +1000 Subject: [PATCH 1/2] Part category collapse is persistent --- InvenTree/part/templates/part/category.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 343d7a8c40..6a076ef8ca 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -36,9 +36,9 @@ {% if category and category.children.all|length > 0 %} -{% include "part/subcategories.html" with children=category.children.all collapse_id="children"%} +{% include "part/subcategories.html" with children=category.children.all collapse_id="categories" %} {% elif children|length > 0 %} -{% include "part/subcategories.html" with children=children %} +{% include "part/subcategories.html" with children=children collapse_id="categories" %} {% endif %}
@@ -65,6 +65,18 @@ {% block js_ready %} {{ block.super }} + if (sessionStorage.getItem("inventree-show-part-categories")) { + $("#collapse-item-categories").collapse('show'); + } + + $("#collapse-item-categories").on('shown.bs.collapse', function() { + sessionStorage.setItem('inventree-show-part-categories', 1); + }); + + $("#collapse-item-categories").on('hidden.bs.collapse', function() { + sessionStorage.removeItem('inventree-show-part-categories'); + }); + $("#cat-create").click(function() { launchModalForm( "{% url 'category-create' %}", From 0fba236eefa9ed9b9ca04506fa41abef9afaa796 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 29 Aug 2019 15:52:32 +1000 Subject: [PATCH 2/2] Stock locations are now persistent --- InvenTree/stock/templates/stock/location.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 8fbf26166d..30adba9336 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -54,6 +54,19 @@ {% endblock %} {% block js_ready %} {{ block.super }} + + if (sessionStorage.getItem("inventree-show-part-locations")) { + $("#collapse-item-locations").collapse('show'); + } + + $("#collapse-item-locations").on('shown.bs.collapse', function() { + sessionStorage.setItem('inventree-show-part-locations', 1); + }); + + $("#collapse-item-locations").on('hidden.bs.collapse', function() { + sessionStorage.removeItem('inventree-show-part-locations'); + }); + $('#location-create').click(function () { launchModalForm("{% url 'stock-location-create' %}", {