Refactor Addresses list view

This commit is contained in:
Santiago L 2021-09-27 13:37:11 +02:00
parent a9c59edbf2
commit 6d7ee0b76a
2 changed files with 18 additions and 15 deletions

View file

@ -231,7 +231,12 @@ class Address(OrchestraModel):
verbose_name = _('Mail addresses')
description = _('Description details for mail addresses page.')
fields = ('mail_address', 'aliases', 'type', 'type_detail')
param_defaults = {"id": None,}
param_defaults = {
"id": None,
"domain": None,
"mailboxes": [],
"forward": None,
}
FORWARD = 'forward'
MAILBOX = 'mailbox'

View file

@ -6,31 +6,29 @@
<table class="table service-list">
<colgroup>
<col span="1" style="width: 25%;">
<col span="1" style="width: 50%;">
<col span="1" style="width: 5%;">
<col span="1" style="width: 20%;">
<col span="1" style="width: 25%;">
<col span="1" style="width: 25%;">
<col span="1" style="width: 25%;">
</colgroup>
<thead class="thead-dark">
<tr>
<th scope="col">{% trans "Mail address" %}</th>
<th scope="col">{% trans "Aliases" %}</th>
<th scope="col">{% trans "Type" %}</th>
<th scope="col">{% trans "Type details" %}</th>
<th scope="col">{% trans "Email" %}</th>
<th scope="col">{% trans "Domain" %}</th>
<th scope="col">{% trans "Mailboxes" %}</th>
<th scope="col">{% trans "Forward" %}</th>
</tr>
</thead>
<tbody>
{% for obj in object_list %}
<tr>
<td><a href="{% url 'musician:mail-update' obj.id %}">{{ obj.mail_address }}</a></td>
<td>{{ obj.aliases|join:" , " }}</td>
<td>{{ obj.type|capfirst }}</td>
<td>{{ obj.domain.name }}</td>
<td>
{% if obj.type == 'mailbox' %}
{% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %}
{% else %}
{{ obj.type_detail }}
{% endif %}
{% for mailbox in obj.mailboxes %}
<a href="#TODO-mailbox-detail-{{ mailbox.id }}">{{ mailbox.name }}</a>
{% endfor %}
</td>
<td>{{ obj.forward }}</td>
</tr>
{% endfor %}
</tbody>