Use the collapse template for the stock location list view

This commit is contained in:
Oliver Walters 2019-05-02 19:02:03 +10:00
parent fbb120da53
commit 4d7ac870e0
4 changed files with 41 additions and 57 deletions

View File

@ -33,9 +33,9 @@
</div>
</div>
{% 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 %}
<hr>

View File

@ -1,14 +1,10 @@
{% if children|length > 0 %}
<hr>
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">{{ children | length }} Child Categories</a>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">
{% extends "collapse.html" %}
{% block collapse_title %}
{{ children | length }} Child Categories
{% endblock %}
{% block collapse_content %}
<ul class="list-group">
{% for child in children %}
<li class="list-group-item">
@ -20,8 +16,4 @@
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}

View File

@ -31,10 +31,10 @@
</div>
</div>
{% 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 %}
<hr>

View File

@ -1,14 +1,10 @@
{% if children|length > 0 %}
<hr>
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">Sub-Locations</a><span class='badge'>{{ children|length }}</span>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<div class="panel-body">
{% extends "collapse.html" %}
{% block collapse_title %}
Sub-Locations<span class='badge'>{{ children|length }}</span>
{% endblock %}
{% block collapse_content %}
<ul class="list-group">
{% for child in children %}
<li class="list-group-item"><a href="{% url 'stock-location-detail' child.id %}">{{ child.name }}</a> - <i>{{ child.description }}</i></li>
@ -16,8 +12,4 @@
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endif %}
{% endblock %}