mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 17:06:09 +00:00
On the VM and host lists a tag's badge chooses it in the tag list, the
tag list offers "No tag" for the rows without one, and each choice says
how many of the listed rows it shows ("prod (42)"); an owner counts only
their own VMs.
18 lines
1.2 KiB
HTML
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 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 %}
|