Commit 706f3d75 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Enhance mandates display

parent 0bb50137
<div class="col-sm-12 col-md-6 mandate ">
<div class="thumbnail">
<span class="mandate-badge"><span class="chamber-icon" style="background-image: url(/static/collected/images/chamber-an.png)"></span></span>
<h4 class="text-center">
Assemblée nationale
</h4>
<hr/>
<div class="text-center desc">
<b>Député</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate ">
<div class="thumbnail">
<span class="mandate-badge"><span class="flag-icon flag-icon-fr"></span></span>
<h4 class="text-center">
France
</h4>
<hr/>
<div class="text-center desc">
<b>membre</b>
from present
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate ">
<div class="thumbnail">
<span class="mandate-badge"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-ser.png)"></span></span>
<h4 class="text-center">
Socialiste, écologiste et républicain
</h4>
<hr/>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate ">
<div class="thumbnail">
<span class="badge mandate-badge">AnComLois</span>
<h4 class="text-center">
Commission des lois constitutionnelles, de la législation et de l'administration générale de la république
</h4>
<hr/>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate ">
<div class="thumbnail">
<h4 class="text-center">
Commission d'enquête visant à évaluer les conséquences sur l'investissement public et les services publics de proximité de la baisse des dotations de l'État aux communes et aux epci
</h4>
<hr/>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études papier et imprimés
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études gaz de schiste
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études sida
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études amiante
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<span class="badge mandate-badge">07-2</span>
<h4 class="text-center">
Ardèche (2ème circonscription)
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<span class="badge mandate-badge">07</span>
<h4 class="text-center">
Ardèche
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études textile et industries de main d'oeuvre
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études plasturgie
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études automobile
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études chataigneraie
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
---
<div class="col-sm-12 col-md-6 mandate mandate-secondary">
<div class="thumbnail">
<h4 class="text-center">
Groupe d'études fillière véhicules industriels
</h4>
<div class="text-center desc">
<b>membre</b>
from 20/06/2012
to present
</div>
</div>
</div>
\ No newline at end of file
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">France
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from present to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Assemblée nationale
</a>
</h3>
<hr/>
<p><span class="lead">Député</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Commission d'enquête visant à évaluer les conséquences sur l'investissement public et les services publics de proximité de la baisse des dotations de l'État aux communes et aux epci
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Commission des lois constitutionnelles, de la législation et de l'administration générale de la république
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études amiante
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études automobile
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études chataigneraie
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études fillière véhicules industriels
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études gaz de schiste
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études papier et imprimés
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études plasturgie
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études sida
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Groupe d'études textile et industries de main d'oeuvre
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Ardèche
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Ardèche (2ème circonscription)
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
---
<div class="col-sm-6 col-md-4 mandate">
<div class="thumbnail">
<div class="caption">
<h3 class="text-center">
<a href="">Socialiste, écologiste et républicain
</a>
</h3>
<hr/>
<p><span class="lead">membre</span> from 20/06/2012 to present</p>
</div>
</div>
</div>
\ No newline at end of file
......@@ -5,12 +5,16 @@ class RepresentativeMandatesTest(RepresentativeBaseTest):
tab = 'mandates'
"""
No additional queries (mandates already prefetched for rep header box)
Representative queries plus
- 1 for mandates
"""
queries = RepresentativeBaseTest.queries
queries = RepresentativeBaseTest.queries + 1
def test_queries(self):
self.do_query_test()
def test_mandates(self):
self.selector_test('.mandate')
def test_current_mandates(self):
self.selector_test('.current-mandates .mandate')
def test_past_mandates(self):
self.selector_test('.past-mandates .mandate')
# coding: utf-8
from django.db.models import IntegerField, Case, Value, When
from .representative_detail_base import RepresentativeDetailBase
class RepresentativeDetailMandates(RepresentativeDetailBase):
template_name = 'representatives/representative_detail_mandates.html'
mandates_order = ['chamber', 'country', 'committee', 'delegation']
def get_context_data(self, **kwargs):
c = super(RepresentativeDetailMandates,
self).get_context_data(**kwargs)
c['tab'] = 'mandates'
c['mandates'] = c['object'].mandates.all()
c['mandates'] = c['object'].mandates.annotate(
weight=Case(
When(group__kind='chamber', then=Value(1)),
When(group__kind='country', then=Value(2)),
When(group__kind='group', then=Value(3)),
When(group__kind='committee', then=Value(4)),
default=Value(100),
output_field=IntegerField()
)
).select_related('group__chamber').order_by('-end_date', 'weight')
return c
......@@ -313,7 +313,35 @@ iframe {
/***************************************************************
Dossiers
Mandates
***************************************************************/
.mandate hr {
margin: 5px 0;
}
.mandate .desc {
margin-bottom: 5px;
}
.mandate-secondary h4 {
font-size: .8em;
color: #666;
}
.mandate-secondary .desc {
font-size: .8em;
color: #666;
}
.mandate-badge {
position: absolute;
top: -0.5em;
right: 0.5em;
}
/***************************************************************
Dossiers
***************************************************************/
......
.address
- if address.floor and address.office_number
.office Floor {{ address.floor }} - office {{ address.office_number }}
.street {{ address.number }} {{ address.street }}
.city {{ address.city }} {{ address.postcode }}, {{ address.country.name }}
{% load i18n %}
{% load memopol_tags %}
<div class="col-sm-12 col-md-6 mandate {% if mandate.weight >= 100 %}mandate-secondary{% endif %}">
<div class="thumbnail">
{% if mandate.group.kind == 'chamber' %}
<span class="mandate-badge">{{ mandate.group.chamber|chamber_icon }}</span>
{% elif mandate.group.kind == 'group' %}
<span class="mandate-badge">{{ mandate.group|group_icon }}</span>
{% elif mandate.group.kind == 'country' %}
<span class="mandate-badge">{{ representative.country|country_flag }}</span>
{% elif mandate.group.abbreviation %}