1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00
webvirtcloud/instances/templates/instance_name_cell.html
catborise 7810fb39fe feat(tags): smaller tag badges, three on the VM list
Tag badges are smaller than other badges everywhere, and the VM list
shows a VM's first three tags and "…" for the others: it names them in
its tooltip and shows them when pressed, by mouse or keyboard. A VM with
many tags no longer widens the name column and the table with it; the
tag list still filters by any of them.
2026-11-18 23:31:55 +03:00

18 lines
1.2 KiB
HTML

{% load i18n %}
{% load bootstrap_icons %}
{# a VM's name, its title, and with owners its owners: the first as a badge, the others counted #}
<a class="fw-semibold text-break" href="{% url 'instances:instance' instance.id %}">{{ instance.name }}</a>
{% if instance.info and instance.title %}<div class="small text-body-secondary text-break">{{ instance.title }}</div>{% endif %}
{% with tags=instance.tags.all %}{% if tags %}<div class="mt-1">{% include 'common/tag_badges.html' with tags=tags|slice:":3" more=tags|slice:"3:" filter=True %}</div>{% endif %}{% endwith %}
{% if owners %}
{% with users=instance.userinstance_set.all %}
{% if users %}
<div class="mt-1">
<span class="badge text-bg-light border">{% bs_icon 'person' %} {{ users.0.user }}</span>
{% if users|length > 1 %}
<span class="badge text-bg-light border" title="{% for owner in users|slice:"1:" %}{{ owner.user }}{% if not forloop.last %}, {% endif %}{% endfor %}">+{{ users|length|add:"-1" }}<span class="visually-hidden"> {% trans "more owners" %}: {% for owner in users|slice:"1:" %}{{ owner.user }}{% if not forloop.last %}, {% endif %}{% endfor %}</span></span>
{% endif %}
</div>
{% endif %}
{% endwith %}
{% endif %}