diff --git a/musician/templates/musician/addresses.html b/musician/templates/musician/addresses.html new file mode 100644 index 0000000..3c2e6f5 --- /dev/null +++ b/musician/templates/musician/addresses.html @@ -0,0 +1,42 @@ +{% extends "musician/mail_base.html" %} +{% load i18n %} + +{% block tabcontent %} +
+ + + + + + + + + + + + + + + + + {% for obj in object_list %} + + + + + + + {% endfor %} + + {% include "musician/components/table_paginator.html" %} +
{% trans "Mail address" %}{% trans "Aliases" %}{% trans "Type" %}{% trans "Type details" %}
{{ obj.mail_address }}{{ obj.aliases|join:" , " }}{{ obj.type|capfirst }} + {% if obj.type == 'mailbox' %} + {% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %} + {% else %} + {{ obj.type_detail }} + {% endif %} +
+ {% trans "New mail address" %} + +
+{% endblock %} diff --git a/musician/templates/musician/mail.html b/musician/templates/musician/mail.html deleted file mode 100644 index 38f0fe3..0000000 --- a/musician/templates/musician/mail.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "musician/base.html" %} -{% load i18n %} - -{% block content %} -{% if active_domain %} -{% trans "Go to global" %} -{% endif %} - -

{{ service.verbose_name }}{% if active_domain %} {% trans "for" %} {{ active_domain.name }}{% endif %}

-

{{ service.description }}

- - - - - - - - - - - - - - - - - {% for obj in object_list %} - - - - - - - {% endfor %} - - {% include "musician/components/table_paginator.html" %} -
{% trans "Mail address" %}{% trans "Aliases" %}{% trans "Type" %}{% trans "Type details" %}
{{ obj.mail_address }}{{ obj.aliases|join:" , " }}{{ obj.type|capfirst }} - {% if obj.type == 'mailbox' %} - {% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %} - {% else %} - {{ obj.type_detail }} - {% endif %} -
-{% trans "New mail address" %} -{% endblock %} diff --git a/musician/templates/musician/mail_base.html b/musician/templates/musician/mail_base.html new file mode 100644 index 0000000..1529874 --- /dev/null +++ b/musician/templates/musician/mail_base.html @@ -0,0 +1,30 @@ +{% extends "musician/base.html" %} +{% load i18n %} + +{% block content %} +{% if active_domain %} +{% trans "Go to global" %} +{% endif %} + +

{{ service.verbose_name }}{% if active_domain %} {% trans "for" + %} {{ active_domain.name }}{% endif %}

+

{{ service.description }}

+ +{% with request.resolver_match.url_name as url_name %} + + +{% endwith %} + +
+ {% block tabcontent %} + {% endblock %} + +{% endblock %} diff --git a/musician/templates/musician/mailboxes.html b/musician/templates/musician/mailboxes.html new file mode 100644 index 0000000..2c731b5 --- /dev/null +++ b/musician/templates/musician/mailboxes.html @@ -0,0 +1,34 @@ +{% extends "musician/mail_base.html" %} +{% load i18n %} + +{% block tabcontent %} +
+ + + + + + + + + + + + + + + + + {% for mailbox in mailboxes %} + + + + + + + {% endfor %} + + {% include "musician/components/table_paginator.html" %} + + +{% endblock %} diff --git a/musician/urls.py b/musician/urls.py index ae2676b..d699832 100644 --- a/musician/urls.py +++ b/musician/urls.py @@ -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//', 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'), diff --git a/musician/views.py b/musician/views.py index bd147a4..412f0e5 100644 --- a/musician/views.py +++ b/musician/views.py @@ -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
{% trans "Name" %}{% trans "Filtering" %}{% trans "Addresses" %}{% trans "Active" %}
{{ mailbox.name }}{{ mailbox.filtering }}{{ mailbox.addresses }}