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,27 +1,19 @@
{% 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">
<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>
{% if child.description %}
<i> - {{ child.description }}</i>
{% endif %}
<span class='badge'>{{ child.partcount }}</span>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endif %}
{% 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">
<b><a href="{% url 'category-detail' child.id %}">{{ child.name }}</a></b>
{% if child.description %}
<i> - {{ child.description }}</i>
{% endif %}
<span class='badge'>{{ child.partcount }}</span>
</li>
{% endfor %}
</ul>
{% 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,23 +1,15 @@
{% 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">
<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>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
{% endif %}
{% 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>
<span class='badge'>{{ child.partcount }}</span>
</li>
{% endfor %}
</ul>
{% endblock %}