Merge pull request #453 from SchrodingersGat/collapsible-sections

Collapsible sections
This commit is contained in:
Oliver 2019-08-29 16:00:01 +10:00 committed by GitHub
commit 42eafcb51f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 2 deletions

View File

@ -36,9 +36,9 @@
</div> </div>
{% if category and category.children.all|length > 0 %} {% 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 %} {% elif children|length > 0 %}
{% include "part/subcategories.html" with children=children %} {% include "part/subcategories.html" with children=children collapse_id="categories" %}
{% endif %} {% endif %}
<hr> <hr>
@ -65,6 +65,18 @@
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ 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() { $("#cat-create").click(function() {
launchModalForm( launchModalForm(
"{% url 'category-create' %}", "{% url 'category-create' %}",

View File

@ -54,6 +54,19 @@
{% endblock %} {% endblock %}
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ 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 () { $('#location-create').click(function () {
launchModalForm("{% url 'stock-location-create' %}", launchModalForm("{% url 'stock-location-create' %}",
{ {