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') verbose_name = _('Mail addresses')
description = _('Description details for mail addresses page.') description = _('Description details for mail addresses page.')
fields = ('mail_address', 'aliases', 'type', 'type_detail') fields = ('mail_address', 'aliases', 'type', 'type_detail')
param_defaults = {"id": None,} param_defaults = {
"id": None,
"domain": None,
"mailboxes": [],
"forward": None,
}
FORWARD = 'forward' FORWARD = 'forward'
MAILBOX = 'mailbox' MAILBOX = 'mailbox'

View File

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