Set title pages.

This commit is contained in:
Santiago Lamora 2020-01-07 13:53:59 +01:00
parent d3d75e7542
commit f6d13d6b95
2 changed files with 44 additions and 6 deletions

View File

@ -11,7 +11,7 @@
<meta name="robots" content="NONE,NOARCHIVE" /> <meta name="robots" content="NONE,NOARCHIVE" />
{% endblock %} {% endblock %}
<title>{% block title %}{% if name %}{{ name }} {% endif %}Django musician{% endblock %}</title> <title>{% block title %}{% if title %}{{ title }} {% endif %}Django musician{% endblock %}</title>
{% block style %} {% block style %}
{% block bootstrap_theme %} {% block bootstrap_theme %}
@ -23,9 +23,6 @@
<link rel="stylesheet" href="{% static "musician/fontawesome/css/all.min.css" %}" /> <link rel="stylesheet" href="{% static "musician/fontawesome/css/all.min.css" %}" />
<link rel="stylesheet" type="text/css" href="{% static "musician/css/default.css" %}" /> <link rel="stylesheet" type="text/css" href="{% static "musician/css/default.css" %}" />
{% if code_style %}<style>
{{ code_style }}
</style>{% endif %}
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}

View File

@ -25,6 +25,10 @@ from .settings import ALLOWED_RESOURCES
class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
template_name = "musician/dashboard.html" template_name = "musician/dashboard.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('Dashboard'),
}
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
@ -85,6 +89,10 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView): class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
template_name = "musician/profile.html" template_name = "musician/profile.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('User profile'),
}
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
@ -103,7 +111,7 @@ class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
class ServiceListView(CustomContextMixin, ExtendedPaginationMixin, UserTokenRequiredMixin, ListView): class ServiceListView(CustomContextMixin, ExtendedPaginationMixin, UserTokenRequiredMixin, ListView):
"""Base list view to all services""" """Base list view to all services"""
service_class = None service_class = None
template_name = "musician/service_list.html" # TODO move to ServiceListView template_name = "musician/service_list.html"
def get_queryset(self): def get_queryset(self):
if self.service_class is None or self.service_class.api_name is None: if self.service_class is None or self.service_class.api_name is None:
@ -132,9 +140,18 @@ class ServiceListView(CustomContextMixin, ExtendedPaginationMixin, UserTokenRequ
class BillingView(ServiceListView): class BillingView(ServiceListView):
service_class = Bill service_class = Bill
template_name = "musician/billing.html" template_name = "musician/billing.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('Billing'),
}
class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View): class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View):
extra_context = {
# Translators: This message appears on the page title
'title': _('Download bill'),
}
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
pk = self.kwargs.get('pk') pk = self.kwargs.get('pk')
bill = self.orchestra.retrieve_bill_document(pk) bill = self.orchestra.retrieve_bill_document(pk)
@ -145,6 +162,10 @@ class BillDownloadView(CustomContextMixin, UserTokenRequiredMixin, View):
class MailView(ServiceListView): class MailView(ServiceListView):
service_class = MailService service_class = MailService
template_name = "musician/mail.html" template_name = "musician/mail.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('Mail addresses'),
}
def get_queryset(self): def get_queryset(self):
def retrieve_mailbox(value): def retrieve_mailbox(value):
@ -198,6 +219,10 @@ class MailView(ServiceListView):
class MailingListsView(ServiceListView): class MailingListsView(ServiceListView):
service_class = MailinglistService service_class = MailinglistService
template_name = "musician/mailinglists.html" template_name = "musician/mailinglists.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('Mailing lists'),
}
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
@ -223,15 +248,27 @@ class MailingListsView(ServiceListView):
class DatabasesView(ServiceListView): class DatabasesView(ServiceListView):
template_name = "musician/databases.html" template_name = "musician/databases.html"
service_class = DatabaseService service_class = DatabaseService
extra_context = {
# Translators: This message appears on the page title
'title': _('Databases'),
}
class SaasView(ServiceListView): class SaasView(ServiceListView):
service_class = SaasService service_class = SaasService
template_name = "musician/saas.html" template_name = "musician/saas.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('Software as a Service'),
}
class DomainDetailView(CustomContextMixin, UserTokenRequiredMixin, DetailView): class DomainDetailView(CustomContextMixin, UserTokenRequiredMixin, DetailView):
template_name = "musician/domain_detail.html" template_name = "musician/domain_detail.html"
extra_context = {
# Translators: This message appears on the page title
'title': _('Domain details'),
}
def get_queryset(self): def get_queryset(self):
# Return an empty list to avoid a request to retrieve all the # Return an empty list to avoid a request to retrieve all the
@ -254,7 +291,11 @@ class LoginView(FormView):
form_class = LoginForm form_class = LoginForm
success_url = reverse_lazy('musician:dashboard') success_url = reverse_lazy('musician:dashboard')
redirect_field_name = 'next' redirect_field_name = 'next'
extra_context = {'version': get_version()} extra_context = {
# Translators: This message appears on the page title
'title': _('Login'),
'version': get_version(),
}
def get_form_kwargs(self): def get_form_kwargs(self):
kwargs = super().get_form_kwargs() kwargs = super().get_form_kwargs()