li7y/templates/item_list.html

45 lines
1.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{#
SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{% extends "base.html" %}
{% block title %}{% block page_title %}Item List{% endblock %} {{ branding }}{% endblock %}
{% block page_actions %}
<a class="btn btn-primary" href="/items/add">Add</a>
{% endblock %}
{% block main %}
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Class</th>
<th>Parents</th>
</tr>
</thead>
<tbody>
{% for item in item_list -%}
{% let class = item_classes.get(item.class).unwrap() %}
<tr>
<td><a href="/item/{{ item.id }}">{{ item.name }}</a></td>
<td><a href="/item-class/{{ class.id }}">{{ class.name }}</a></td>
<td>
<ol class="breadcrumb mb-0">
{%- let parents = item_tree.get(item.id).unwrap() -%}
{%- if parents.len() > 3 %}
<li class="breadcrumb-item"></li>
{%- endif %}
{%- for parent in parents.iter().rev().take(3).rev() %}
{%- let parent = items.get(parent).unwrap() %}
<li class="breadcrumb-item"><a href="/item/{{ parent.id }}">{{ parent.name }}</a></li>
{%- endfor %}
<li class="breadcrumb-item active">{{ item.name }}</li>
</ol>
</td>
</tr>
{% endfor -%}
</tbody>
</table>
{% endblock %}