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"> <b><a href="{% url 'category-detail' child.id %}">{{ child.name }}</a></b>
<ul class="list-group"> {% if child.description %}
{% for child in children %} <i> - {{ child.description }}</i>
<li class="list-group-item"> {% endif %}
<b><a href="{% url 'category-detail' child.id %}">{{ child.name }}</a></b> <span class='badge'>{{ child.partcount }}</span>
{% if child.description %} </li>
<i> - {{ child.description }}</i> {% endfor %}
{% endif %} </ul>
<span class='badge'>{{ child.partcount }}</span> {% endblock %}
</li>
{% endfor %}
</ul>
</div>
</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"> <span class='badge'>{{ child.partcount }}</span>
<ul class="list-group"> </li>
{% for child in children %} {% endfor %}
<li class="list-group-item"><a href="{% url 'stock-location-detail' child.id %}">{{ child.name }}</a> - <i>{{ child.description }}</i></li> </ul>
<span class='badge'>{{ child.partcount }}</span> {% endblock %}
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endif %}