Implement some templates
This commit is contained in:
parent
f911a40c50
commit
926207564e
5 changed files with 135 additions and 31 deletions
|
@ -0,0 +1,29 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load admin_urls %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static "inventory/css/cell.css" %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ object.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2><a href="{{ object.container_url }}"><img class="icon" src="{% static "inventory/img/back.svg" %}"></a>{{ object.name }} <span class="small">{{ object.description}}</span></h2>
|
||||
|
||||
<table class="box">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in layouted.0 %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,32 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load admin_urls %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static "inventory/css/cell.css" %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ object.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2><a href="{{ object.container_url }}"><img class="icon" src="{% static "inventory/img/back.svg" %}"></a>{{ object.name }} <span class="small">{{ object.description}}</span></h2>
|
||||
|
||||
<table class="box">
|
||||
<tbody>
|
||||
{% for line in layouted %}
|
||||
<tr>
|
||||
{% for item in line %}
|
||||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,30 @@
|
|||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load admin_urls %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static "inventory/css/cell.css" %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ object.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2><a href="{{ object.container_url }}"><img class="icon" src="{% static "inventory/img/back.svg" %}"></a>{{ object.name }} <span class="small">{{ object.description}}</span></h2>
|
||||
|
||||
<table class="box">
|
||||
<tbody>
|
||||
{% for item in layouted.0 %}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endblock %}
|
|
@ -3,16 +3,16 @@
|
|||
{% load admin_urls %}
|
||||
|
||||
{% block head %}
|
||||
<link rel="stylesheet" type="text/css" href="{% static "inventory/css/box-all.css" %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static "inventory/css/cell.css" %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ context.title }}{% endblock %}
|
||||
{% block title %}{{ object.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ object.name }}</h1>
|
||||
<h2><a href="{{ object.container_url}}"><img class="icon" src="{% static "inventory/img/back.svg" %}"></a>{{ object.name }} <span class="small">{{ object.description}}</span></h2>
|
||||
|
||||
{% for part in layouted %}
|
||||
<table>
|
||||
<table class="box">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
@ -25,33 +25,12 @@
|
|||
{% for line in part %}
|
||||
<tr>
|
||||
<th>{{ forloop.counter }}</th>
|
||||
{% for column in line %}
|
||||
{% for item in line %}
|
||||
<td>
|
||||
<div class="cell">
|
||||
{% if column.name %}
|
||||
{% if column.metadata.package %}
|
||||
<div class="package">{{ column.metadata.package }}</div>
|
||||
{% endif %}
|
||||
{% if column.documentation.all %}
|
||||
<a class="title" href="{{ column.documentation.all.0.file.url }}" {% if column.description %}title="{{ column.description }}"{% endif %}>
|
||||
{{ column.name | linebreaksbr }}
|
||||
</a>
|
||||
{% else %}
|
||||
<div class="title missing-link" title="{{ column.description }}">
|
||||
{{ column.name | linebreaksbr }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<a class="edit" href="{% url "admin:inventory_item_change" object_id=column.pk %}"><img src="{% static "inventory/img/edit.png" %}"></a>
|
||||
|
||||
{% if column.price %}
|
||||
<div class="price">{{ column.price | floatformat:2 }} €</div>
|
||||
{% endif %}
|
||||
{% if column.distributor %}
|
||||
<img class="shop" src="{{ column.distributor.icon.url }}" title="{{ column.distributor.name }}">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a class="title missing" href="{% url "admin:inventory_item_add" %}?index={{ column.index }}&container={{ column.container_id }}"><img src="{% static "inventory/img/add.png" %}"></a>
|
||||
{% endif %}
|
||||
<div class="compartments">
|
||||
{% for compartment in item %}
|
||||
{% include "inventory/cell.html" with item=compartment %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</td>
|
||||
{% endfor %}
|
||||
|
|
34
inventory/templates/inventory/cell.html
Normal file
34
inventory/templates/inventory/cell.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{% load static %}
|
||||
{% load admin_urls %}
|
||||
|
||||
<div class="cell">
|
||||
{% if item.name %}
|
||||
{% if item.metadata.package %}
|
||||
<div class="package">{{ item.metadata.package }}</div>
|
||||
{% endif %}
|
||||
{% if item.documentation.all %}
|
||||
<a class="title" href="{{ item.documentation.all.0.file.url }}" {% if item.description %}title="{{ item.description }}"{% endif %}>
|
||||
{{ item.name | linebreaksbr }}
|
||||
</a>
|
||||
{% else %}
|
||||
<div class="title missing-link" title="{{ item.description }}">
|
||||
{{ item.name | linebreaksbr }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="cell-buttons">
|
||||
<a class="edit" href="{% url "admin:inventory_item_change" object_id=item.pk %}"><img class="icon" src="{% static "inventory/img/edit.svg" %}"></a>
|
||||
<a class="details" href="{% url "item-detail" pk=item.pk %}"><img class="icon" src="{% static "inventory/img/detail.svg" %}"></a>
|
||||
</div>
|
||||
|
||||
{% if item.price %}
|
||||
<div class="price">{{ item.price | floatformat:2 }} €</div>
|
||||
{% endif %}
|
||||
{% if item.distributor %}
|
||||
<img class="shop" src="{{ item.distributor.icon.url }}" title="{{ item.distributor.name }}">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<div class="cell-buttons">
|
||||
<a class="title missing" href="{% url "admin:inventory_item_add" %}?index={{ item.index }}&container={{ item.container_id }}"><br><img class="icon" src="{% static "inventory/img/add.svg" %}"></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
Loading…
Reference in a new issue