Changed some category views to use boostrap list-group

- Looks much fancier!
This commit is contained in:
Oliver 2018-04-14 23:05:36 +10:00
parent 0e2c5e6af5
commit 204874dcb4
6 changed files with 220 additions and 24 deletions

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="150mm"
height="150mm"
viewBox="0 0 531.49607 531.49606"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="folder_closed.svg"
inkscape:export-filename="/home/oliver/InvenTree/InvenTree/static/img/folder_closed.png"
inkscape:export-xdpi="50.799999"
inkscape:export-ydpi="50.799999">
<defs
id="defs4">
<inkscape:path-effect
effect="spiro"
id="path-effect4155"
is_visible="true" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="215.08651"
inkscape:cy="510.45947"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1855"
inkscape:window-height="1056"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-520.86618)">
<g
id="g4205"
transform="translate(-77.288975,54.966576)"
style="stroke-width:25.00000298;stroke-miterlimit:4;stroke-dasharray:none"
inkscape:export-filename="/home/oliver/InvenTree/InvenTree/static/img/folder_closed.png"
inkscape:export-xdpi="50.799999"
inkscape:export-ydpi="50.799999">
<path
inkscape:connector-curvature="0"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffa000;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:25.00000298;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 176.8333,550.27626 c -28.32955,0 -51.13642,22.80687 -51.13642,51.13641 l 0,115.24942 258.96134,-60.54711 -97.67285,-105.83872 -110.15207,0 z"
id="path4177" />
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffca28;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:25.00000298;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect4173"
width="434.67987"
height="310.33328"
x="125.69733"
y="602.68573"
rx="28.773136"
ry="29.555552" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="150mm"
height="150mm"
viewBox="0 0 531.49607 531.49606"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="folder_open.svg"
inkscape:export-filename="/home/oliver/InvenTree/InvenTree/static/img/folder_open.png"
inkscape:export-xdpi="50.800003"
inkscape:export-ydpi="50.800003">
<defs
id="defs4">
<inkscape:path-effect
effect="spiro"
id="path-effect4155"
is_visible="true" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.7"
inkscape:cx="462.22937"
inkscape:cy="510.45947"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1855"
inkscape:window-height="1056"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-520.86618)">
<g
id="g4228"
transform="translate(-248.03745,629.43489)"
style="stroke-width:25.00000298;stroke-miterlimit:4;stroke-dasharray:none">
<path
inkscape:connector-curvature="0"
id="rect4147"
d="m 328.26189,-24.722434 c -28.32955,0 -51.13642,22.8068796 -51.13642,51.13642 l 0,30.82854 0,84.420874 0,166.80171 c 0,16.37378 12.83411,29.5556 28.77442,29.5556 l 377.13316,0 c 15.94032,0 28.77161,-13.18182 28.77161,-29.5556 l 0,-251.222584 c 0,-16.37378 -12.83129,-29.5556 -28.77161,-29.5556 l -196.25334,0 -48.36575,-52.40936 -110.15207,0 z"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffa000;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:25.00000298;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
<rect
transform="matrix(1,0,-0.16547222,0.98621445,0,0)"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffca28;fill-opacity:1;fill-rule:evenodd;stroke:#666666;stroke-width:25.17412473;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect4149"
width="434.84564"
height="247.10779"
x="335.08032"
y="96.763504"
rx="28.784107"
ry="23.534075" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -20,6 +20,20 @@ class PartCategory(InvenTreeTree):
verbose_name = "Part Category"
verbose_name_plural = "Part Categories"
@property
def partcount(self):
""" Return the total part count under this category
(including children of child categories)
"""
count = self.parts.count()
for child in self.children.all():
count += child.partcount
return count
"""
@property
def parts(self):

View File

@ -1,35 +1,32 @@
{% extends "base.html" %}
{% load static %}
{% block content %}
{% include "part/cat_link.html" with category=category %}
{% if children|length > 0 %}
<table>
<tr>
<th>Subcategory</th>
<th>Description</th>
</tr>
Subcategories:
<ul class="list-group">
{% for child in children %}
<tr>
<td><a href="/part/list/?category={{ child.id }}">{{ child.name }}</a></td>
<td>{{ child.description }}</td>
<li class="list-group-item">
<a href="/part/list/?category={{ child.id }}">{{ child.name }}</a> - {{ child.description }}
<span class='badge'>{{ child.partcount }}</span>
</li>
{% endfor %}
</table>
</ul>
{% endif %}
{% if parts|length > 0 %}
<h3>Parts</h3>
<table>
Parts:
<ul class="list-group">
{% for part in parts %}
<tr>
<td><a href="{% url 'part-detail' part.id %}">{{ part.name }}</a></td>
<td>{{ part.description }}</td>
<li class="list-group-item">
<a href="{% url 'part-detail' part.id %}">{{ part.name }}</a> - {{ part.description }}
</li>
</tr>
{% endfor %}
</table>
{% else %}
There are no parts in this category.
</ul>
{% endif %}
{% endblock %}

View File

@ -1,10 +1,17 @@
table, th, td {
border: 1px solid black;
border-collapse: collapse;
margin-left: 5px;
margin-right: 5px;
margin-top: 10px;
margin-bottom: 10px;
}
th, td {
padding: 10px;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 10px;
padding-right: 10px;
}
th {
@ -18,6 +25,13 @@ table tr:nth-child(odd) {
background-color: #fff;
}
.badge {
float: right;
background-color: #777;
color: #fff;
border-radius: 5px;
}
.part-thumb {
width: 150px;
height: 150px;

View File

@ -5,17 +5,16 @@
{% include "stock/loc_link.html" with location=location %}
{% if children|length > 0 %}
<table>
<tr><th>Sublocations</th></tr>
Storage locations:
<ul class="list-group">
{% for child in children %}
<tr>
<td><a href="/stock/list/?location={{ child.id }}">{{ child.name }}</a></td>
</tr>
<li class="list-group-item"><a href="/stock/list/?location={{ child.id }}">{{ child.name }}</a></li>
{% endfor %}
</table>
</ul>
{% endif %}
{% if items|length > 0 %}
Stock items:
<table>
<tr>
<th>Item</th>