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>
</div> </div>
{% if category %} {% if category and category.children.all|length > 0 %}
{% include "part/subcategories.html" with children=category.children.all %} {% include "part/subcategories.html" with children=category.children.all collapse_id="children"%}
{% else %} {% elif children|length > 0 %}
{% include "part/subcategories.html" with children=children %} {% include "part/subcategories.html" with children=children %}
{% endif %} {% endif %}
<hr> <hr>

View File

@ -1,27 +1,19 @@
{% if children|length > 0 %} {% extends "collapse.html" %}
<hr>
<div class="panel-group"> {% block collapse_title %}
<div class="panel panel-default"> {{ children | length }} Child Categories
<div class="panel-heading"> {% endblock %}
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1">{{ children | length }} Child Categories</a> {% block collapse_content %}
</h4> <ul class="list-group">
</div> {% for child in children %}
<div id="collapse1" class="panel-collapse collapse"> <li class="list-group-item">
<div class="panel-body">
<ul class="list-group">
{% for child in children %}
<li class="list-group-item">
<b><a href="{% url 'category-detail' child.id %}">{{ child.name }}</a></b> <b><a href="{% url 'category-detail' child.id %}">{{ child.name }}</a></b>
{% if child.description %} {% if child.description %}
<i> - {{ child.description }}</i> <i> - {{ child.description }}</i>
{% endif %} {% endif %}
<span class='badge'>{{ child.partcount }}</span> <span class='badge'>{{ child.partcount }}</span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
</div> {% endblock %}
</div>
</div>
</div>
{% endif %}

View File

@ -31,10 +31,10 @@
</div> </div>
</div> </div>
{% if location %} {% if location and location.children.all|length > 0 %}
{% include 'stock/location_list.html' with children=location.children.all %} {% include 'stock/location_list.html' with children=location.children.all collapse_id="locations" %}
{% else %} {% elif locations|length > 0 %}
{% include 'stock/location_list.html' with children=locations %} {% include 'stock/location_list.html' with children=locations collapse_id="locations" %}
{% endif %} {% endif %}
<hr> <hr>

View File

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