mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
email_server: Remove tabs from the interface
- All the views are reachable using buttons. - Add title to the domains page as tabs are removed. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
94a6a9b8aa
commit
10c9156a29
3 files changed
+6
-47
No files matched your search
@@ -7,6 +7,8 @@
|
||||
|
||||
{{ block.super }}
|
||||
|
||||
<h2>{% trans "Domains" %}</h2>
|
||||
|
||||
<form action="{{ request.path }}" method="post">
|
||||
|
||||
{% for data in fields %}
|
||||
|
||||
@@ -14,27 +14,13 @@ from django.views.generic.edit import FormView
|
||||
|
||||
import plinth.actions
|
||||
import plinth.utils
|
||||
from plinth.views import AppView, render_tabs
|
||||
from plinth.views import AppView
|
||||
|
||||
from . import aliases as aliases_module
|
||||
from . import audit, forms
|
||||
|
||||
|
||||
class TabMixin(View):
|
||||
admin_tabs = [('', _('Home')), ('domains', _('Domains'))]
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
# Retrieve context data from the next method in the MRO
|
||||
context = super().get_context_data(*args, **kwargs)
|
||||
# Populate context with customized data
|
||||
context['tabs'] = self.render_dynamic_tabs()
|
||||
return context
|
||||
|
||||
def render_dynamic_tabs(self):
|
||||
if plinth.utils.is_user_admin(self.request):
|
||||
return render_tabs(self.request.path, self.admin_tabs)
|
||||
|
||||
return ''
|
||||
class ExceptionsMixin(View):
|
||||
|
||||
def render_validation_error(self, validation_error, status=400):
|
||||
context = self.get_context_data()
|
||||
@@ -55,7 +41,7 @@ class TabMixin(View):
|
||||
return self.render_exception(error)
|
||||
|
||||
|
||||
class EmailServerView(TabMixin, AppView):
|
||||
class EmailServerView(ExceptionsMixin, AppView):
|
||||
"""Server configuration page"""
|
||||
app_id = 'email_server'
|
||||
template_name = 'email_server.html'
|
||||
@@ -211,7 +197,7 @@ class AliasView(FormView):
|
||||
aliases_module.put(self._get_uid(), form.cleaned_data['alias'])
|
||||
|
||||
|
||||
class DomainView(TabMixin, TemplateView):
|
||||
class DomainView(ExceptionsMixin, TemplateView):
|
||||
template_name = 'email_domains.html'
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
|
||||
Reference in new issue
Block a user