Show active_domain and add 'go to global' button.

This commit is contained in:
Santiago Lamora 2019-12-17 11:32:38 +01:00
parent 9cbeb325bb
commit 5520ff63f3
2 changed files with 16 additions and 4 deletions

View File

@ -2,8 +2,11 @@
{% load i18n %} {% load i18n %}
{% block content %} {% 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 }}</h1> <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> <p class="service-description">{{ service.description }}</p>
<table class="table service-list"> <table class="table service-list">
<colgroup> <colgroup>

View File

@ -177,10 +177,19 @@ class MailView(ServiceListView):
def get_queryfilter(self): def get_queryfilter(self):
"""Retrieve query params (if any) to filter queryset""" """Retrieve query params (if any) to filter queryset"""
domain_id = self.request.GET.get('domain') domain_id = self.request.GET.get('domain')
if domain_id is None: if domain_id:
return '' return "domain={}".format(domain_id)
return "domain={}".format(domain_id) return ''
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
domain_id = self.request.GET.get('domain')
if domain_id:
context.update({
'active_domain': self.orchestra.retrieve_domain(domain_id)
})
return context
class MailingListsView(ServiceListView): class MailingListsView(ServiceListView):