Commit c0930e34 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Add links to search by group in representative details

parent bfab6391
......@@ -4,16 +4,21 @@
</dd>
---
<dd>
<span class="flag-icon flag-icon-fr" data-placement="bottom" data-toggle="tooltip" title="France"></span> France
<span class="flag-icon flag-icon-fr" data-placement="bottom" data-toggle="tooltip" title="France"></span>
<a href="/representatives/?country=110">France</a>
</dd>
---
<dd>
<span class="chamber-icon" data-placement="bottom" data-toggle="tooltip" style="background-image: url(/static/collected/images/chamber-an.png)" title="Assemblée nationale"></span> Assemblée nationale
<span class="chamber-icon" data-placement="bottom" data-toggle="tooltip" style="background-image: url(/static/collected/images/chamber-an.png)" title="Assemblée nationale"></span>
<a href="/representatives/?chamber=2">Assemblée nationale</a>
</dd>
---
<dd>
<span class="group-icon" data-placement="bottom" data-toggle="tooltip" style="background-image: url(/static/collected/images/group-an-ser.png)" title="Socialiste, écologiste et républicain"></span> Socialiste, écologiste et républicain
(SER)
<span class="group-icon" data-placement="bottom" data-toggle="tooltip" style="background-image: url(/static/collected/images/group-an-ser.png)" title="Socialiste, écologiste et républicain"></span>
<a href="/representatives/?party=332">
Socialiste, écologiste et républicain
(SER)
</a>
</dd>
---
<dd>Born on 16/08/1978 in Annonay (Ardèche)
......
......@@ -35,11 +35,13 @@ class RepresentativeViewMixin(object):
"""
representative.country = None
representative.country_group = None
representative.main_mandate = None
for m in representative.mandates.all():
if m.constituency.country_id and not representative.country:
representative.country = m.constituency.country
representative.country_group = m.group
if (m.group.kind == 'group' and
not representative.main_mandate):
......
......@@ -28,20 +28,25 @@
<dt>{% trans "Country" %}</dt>
<dd>
{{ representative.country|country_flag }} {{ representative.country.name }}
{{ representative.country|country_flag }}
<a href="{% url 'representative-list' %}?country={{ representative.country_group.pk }}">{{ representative.country.name }}</a>
</dd>
{% with mandate=representative.main_mandate %}
<dt>{% trans "Chamber" %}</dt>
<dd>
{{ mandate.group.chamber|chamber_icon }} {{ mandate.group.chamber.name }}
{{ mandate.group.chamber|chamber_icon }}
<a href="{% url 'representative-list' %}?chamber={{ mandate.group.chamber.pk }}">{{ mandate.group.chamber.name }}</a>
</dd>
<dt>{% trans "Party" %}</dt>
<dd>
{{ mandate.group|group_icon }} {{ mandate.group.name }}
{% if mandate.group.abbreviation %}({{ mandate.group.abbreviation }}){% endif %}
{{ mandate.group|group_icon }}
<a href="{% url 'representative-list' %}?party={{ mandate.group.pk }}">
{{ mandate.group.name }}
{% if mandate.group.abbreviation %}({{ mandate.group.abbreviation }}){% endif %}
</a>
</dd>
{% endwith %}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment