Make a common "item" element for templates

This commit is contained in:
Trever Fischer
2012-11-17 16:04:54 -05:00
parent 465b50c0c9
commit 43c249ce9f
3 changed files with 18 additions and 12 deletions

View File

@@ -1,6 +1,9 @@
.inventory td {
padding: 0;
margin: 0;
min-width: 64px;
height: 64px;
border: 1px solid black;
}
div[class|="inventory-item"] {

View File

@@ -0,0 +1,12 @@
<div class="inventory-item-{{item.material}}">
{% if quantity > 0 %}
<div class="quantity">{{quantity}}</div>
{% endif %}
<div class="name">{{item.name}}</div>
{% if item.damage %}
<div class="damage">
<div class="current"
style="width:{{item.damagePct}}%"></div>
</div>
{% endif %}
</div>

View File

@@ -12,18 +12,9 @@
<tr>
{% endif %}
<td>
<div class="inventory-item-{{slot.item}}">
{% if slot.quantity > 0 %}
<div class="quantity">{{slot.quantity}}</div> <div
class="name">{{slot.name}}</div>
{% if slot.damage %}
<div class="damage">
<div class="current"
style="width:{{slot.damagePct}}%"></div>
</div>
{% endif %}
{% endif %}
</div>
{% if slot.item %}
{% include 'common/item.html' with quantity=slot.quantity item=slot.item %}
{% endif %}
</td>
{% endfor %}
</tr>