Split mail view into addresses & mailboxes
This commit is contained in:
parent
bb07bcd126
commit
9ba1d0a23c
42
musician/templates/musician/addresses.html
Normal file
42
musician/templates/musician/addresses.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
{% extends "musician/mail_base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block tabcontent %}
|
||||
<div class="tab-pane fade show active" id="addresses" role="tabpanel" aria-labelledby="addresses-tab">
|
||||
<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%;">
|
||||
</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>
|
||||
</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>
|
||||
{% if obj.type == 'mailbox' %}
|
||||
{% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %}
|
||||
{% else %}
|
||||
{{ obj.type_detail }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
{% include "musician/components/table_paginator.html" %}
|
||||
</table>
|
||||
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mail-create' %}">{% trans "New mail address" %}</a>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,45 +0,0 @@
|
|||
{% extends "musician/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
{% if active_domain %}
|
||||
<a class="btn-arrow-left" href="{% url 'musician:mails' %}">{% trans "Go to global" %}</a>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="service-name">{{ service.verbose_name }}{% if active_domain %} <span class="font-weight-light">{% trans "for" %} {{ active_domain.name }}</span>{% endif %}</h1>
|
||||
<p class="service-description">{{ service.description }}</p>
|
||||
<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%;">
|
||||
</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>
|
||||
</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>
|
||||
{% if obj.type == 'mailbox' %}
|
||||
{% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %}
|
||||
{% else %}
|
||||
{{ obj.type_detail }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
{% include "musician/components/table_paginator.html" %}
|
||||
</table>
|
||||
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mail-create' %}">{% trans "New mail address" %}</a>
|
||||
{% endblock %}
|
30
musician/templates/musician/mail_base.html
Normal file
30
musician/templates/musician/mail_base.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
{% extends "musician/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
{% if active_domain %}
|
||||
<a class="btn-arrow-left" href="{% url 'musician:mails' %}">{% trans "Go to global" %}</a>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="service-name">{{ service.verbose_name }}{% if active_domain %} <span class="font-weight-light">{% trans "for"
|
||||
%} {{ active_domain.name }}</span>{% endif %}</h1>
|
||||
<p class="service-description">{{ service.description }}</p>
|
||||
|
||||
{% with request.resolver_match.url_name as url_name %}
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if url_name == 'mails' %}active{% endif %}" href="{% url 'musician:mails' %}" role="tab"
|
||||
aria-selected="true">{% trans "Addresses" %}</a>
|
||||
</li>
|
||||
<li class="nav-item {% if url_name == 'mailboxes' %}active{% endif %}">
|
||||
<a class="nav-link" href="{% url 'musician:mailboxes' %}" role="tab" aria-selected="false">{% trans "Mailboxes" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endwith %}
|
||||
|
||||
<div class="tab-content" id="myTabContent">
|
||||
{% block tabcontent %}
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
34
musician/templates/musician/mailboxes.html
Normal file
34
musician/templates/musician/mailboxes.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{% extends "musician/mail_base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block tabcontent %}
|
||||
<div class="tab-pane fade show active" id="mailboxes" role="tabpanel" aria-labelledby="mailboxes-tab">
|
||||
<table class="table service-list">
|
||||
<colgroup>
|
||||
<col span="1" style="width: 20%;">
|
||||
<col span="1" style="width: 10%;">
|
||||
<col span="1" style="width: 60%;">
|
||||
<col span="1" style="width: 10%;">
|
||||
</colgroup>
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th scope="col">{% trans "Name" %}</th>
|
||||
<th scope="col">{% trans "Filtering" %}</th>
|
||||
<th scope="col">{% trans "Addresses" %}</th>
|
||||
<th scope="col">{% trans "Active" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for mailbox in mailboxes %}
|
||||
<tr>
|
||||
<td>{{ mailbox.name }}</td>
|
||||
<td>{{ mailbox.filtering }}</td>
|
||||
<td>{{ mailbox.addresses }}</td>
|
||||
<td class="pl-4 text-{{ mailbox.is_active|yesno:'success,danger' }}"><i class="fas fa-{{ mailbox.is_active|yesno:'check,times' }}"></i></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
{% include "musician/components/table_paginator.html" %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -22,6 +22,7 @@ urlpatterns = [
|
|||
path('mails/', views.MailView.as_view(), name='mails'),
|
||||
path('mails/new/', views.MailCreateView.as_view(), name='mail-create'),
|
||||
path('mails/<int:pk>/', views.MailUpdateView.as_view(), name='mail-update'),
|
||||
path('mailboxes/', views.MailboxesView.as_view(), name='mailboxes'),
|
||||
path('mailing-lists/', views.MailingListsView.as_view(), name='mailing-lists'),
|
||||
path('databases/', views.DatabasesView.as_view(), name='databases'),
|
||||
path('software-as-a-service/', views.SaasView.as_view(), name='saas'),
|
||||
|
|
|
@ -170,7 +170,7 @@ class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View):
|
|||
|
||||
class MailView(ServiceListView):
|
||||
service_class = Address
|
||||
template_name = "musician/mail.html"
|
||||
template_name = "musician/addresses.html"
|
||||
extra_context = {
|
||||
# Translators: This message appears on the page title
|
||||
'title': _('Mail addresses'),
|
||||
|
@ -199,6 +199,7 @@ class MailView(ServiceListView):
|
|||
context.update({
|
||||
'active_domain': self.orchestra.retrieve_domain(domain_id)
|
||||
})
|
||||
context['mailboxes'] = self.orchestra.retrieve_mailbox_list()
|
||||
return context
|
||||
|
||||
|
||||
|
@ -287,6 +288,26 @@ class MailingListsView(ServiceListView):
|
|||
return ''
|
||||
|
||||
|
||||
class MailboxesView(ServiceListView):
|
||||
# TODO (@slamora) refactor after encapsulating Mailbox as a service
|
||||
# service_class = Mailbox
|
||||
template_name = "musician/mailboxes.html"
|
||||
extra_context = {
|
||||
# Translators: This message appears on the page title
|
||||
'title': _('Mailboxes'),
|
||||
}
|
||||
|
||||
def get_queryset(self):
|
||||
# TODO (@slamora) refactor after encapsulating Mailbox as a service
|
||||
return self.orchestra.retrieve_mailbox_list()
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
# TODO (@slamora) refactor after encapsulating Mailbox as a service
|
||||
context['mailboxes'] = context['object_list']
|
||||
return context
|
||||
|
||||
|
||||
class DatabasesView(ServiceListView):
|
||||
template_name = "musician/databases.html"
|
||||
service_class = DatabaseService
|
||||
|
|
Loading…
Reference in a new issue