Commit 0bb50137 authored by Nicolas Joyard's avatar Nicolas Joyard
Browse files

Color for score badges

parent 212376c6
......@@ -194,6 +194,24 @@ def proposal_status_label(status, recommendation=None):
return mark_safe(pattern % (color, status))
@register.filter
def score_badge(score, tooltip=None):
if score > 0:
color = 'success'
elif score < 0:
color = 'danger'
else:
color = 'primary'
attrs = ''
if tooltip:
attrs = 'data-toggle="tooltip" data-placement="%s" title="%s"'
attrs = attrs % ('left', tooltip)
pattern = '<span class="badge badge-%s" %s>%s</span>'
return mark_safe(pattern % (color, attrs, score))
@register.filter
def cast_str(val):
return str(val)
<dd>
<span class="badge" data-placement="right" data-toggle="tooltip" title="Total score is the sum of score contributions for each of this representatives votes">-115</span>
<span class="badge badge-danger" data-placement="left" data-toggle="tooltip" title="Total score is the sum of score contributions for each of this representatives votes">-115</span>
</dd>
---
<dd>
......
......@@ -30,7 +30,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Gauche%20d%C3%A9mocrate%20et%20r%C3%A9publicaine/" title="Gauche démocrate et républicaine"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-gdr.png)"></span></a>
</p>
<p class="text-right"><span class="badge">35</span></p>
<p class="text-right"><span class="badge badge-success">35</span></p>
</div>
</div>
......@@ -70,7 +70,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Union%20des%20d%C3%A9mocrates%20et%20ind%C3%A9pendants/" title="Union des démocrates et indépendants"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-udi.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-305</span></p>
<p class="text-right"><span class="badge badge-danger">-305</span></p>
</div>
</div>
......@@ -110,7 +110,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Les%20r%C3%A9publicains/" title="Les républicains"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-lr.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-205</span></p>
<p class="text-right"><span class="badge badge-danger">-205</span></p>
</div>
</div>
......@@ -150,7 +150,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Les%20r%C3%A9publicains/" title="Les républicains"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-lr.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-110</span></p>
<p class="text-right"><span class="badge badge-danger">-110</span></p>
</div>
</div>
......@@ -190,7 +190,7 @@
<a class="icon-badge" href="/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/" title="Group of the Progressive Alliance of Socialists and Democrats in the European Parliament"><span class="group-icon" style="background-image: url(/static/collected/images/group-ep-sd.png)"></span></a>
</p>
<p class="text-right"><span class="badge">0</span></p>
<p class="text-right"><span class="badge badge-primary">0</span></p>
</div>
</div>
......@@ -230,7 +230,7 @@
<a class="icon-badge" href="/legislature/representative/group/European%20Parliament/Group%20of%20the%20Progressive%20Alliance%20of%20Socialists%20and%20Democrats%20in%20the%20European%20Parliament/" title="Group of the Progressive Alliance of Socialists and Democrats in the European Parliament"><span class="group-icon" style="background-image: url(/static/collected/images/group-ep-sd.png)"></span></a>
</p>
<p class="text-right"><span class="badge">1480</span></p>
<p class="text-right"><span class="badge badge-success">1480</span></p>
</div>
</div>
......@@ -270,7 +270,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Socialiste,%20%C3%A9cologiste%20et%20r%C3%A9publicain/" title="Socialiste, écologiste et républicain"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-ser.png)"></span></a>
</p>
<p class="text-right"><span class="badge">0</span></p>
<p class="text-right"><span class="badge badge-primary">0</span></p>
</div>
</div>
......@@ -310,7 +310,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Les%20r%C3%A9publicains/" title="Les républicains"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-lr.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-135</span></p>
<p class="text-right"><span class="badge badge-danger">-135</span></p>
</div>
</div>
......@@ -350,7 +350,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Les%20r%C3%A9publicains/" title="Les républicains"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-lr.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-195</span></p>
<p class="text-right"><span class="badge badge-danger">-195</span></p>
</div>
</div>
......@@ -390,7 +390,7 @@
<a class="icon-badge" href="/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People's%20Party%20(Christian%20Democrats)/" title="Group of the European People's Party (Christian Democrats)"><span class="group-icon" style="background-image: url(/static/collected/images/group-ep-epp.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-1216</span></p>
<p class="text-right"><span class="badge badge-danger">-1216</span></p>
</div>
</div>
......@@ -430,7 +430,7 @@
<a class="icon-badge" href="/legislature/representative/group/European%20Parliament/Group%20of%20the%20European%20People's%20Party%20(Christian%20Democrats)/" title="Group of the European People's Party (Christian Democrats)"><span class="group-icon" style="background-image: url(/static/collected/images/group-ep-epp.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-1216</span></p>
<p class="text-right"><span class="badge badge-danger">-1216</span></p>
</div>
</div>
......@@ -470,7 +470,7 @@
<a class="icon-badge" href="/legislature/representative/group/Assembl%C3%A9e%20nationale/Gauche%20d%C3%A9mocrate%20et%20r%C3%A9publicaine/" title="Gauche démocrate et républicaine"><span class="group-icon" style="background-image: url(/static/collected/images/group-an-gdr.png)"></span></a>
</p>
<p class="text-right"><span class="badge">-235</span></p>
<p class="text-right"><span class="badge badge-danger">-235</span></p>
</div>
</div>
......
<a aria-controls="dossier-15424" aria-expanded="false" data-parent="#accordion-dossier" data-toggle="collapse" href="#dossier-15424" role="button">
Pouvoirs publics : application de la loi relative à l’état d’urgence
<span class="pull-right">
<span class="badge" data-placement="left" data-toggle="tooltip" title="Score for the representative on this specific dossier">-100</span>
<span class="badge badge-danger" data-placement="left" data-toggle="tooltip" title="Score for the representative on this specific dossier">-100</span>
</span>
</a>
---
<a aria-controls="dossier-15409" aria-expanded="false" data-parent="#accordion-dossier" data-toggle="collapse" href="#dossier-15409" role="button">
Pouvoirs publics : prorogation de l'application de la loi sur l'état d'urgence
<span class="pull-right">
<span class="badge" data-placement="left" data-toggle="tooltip" title="Score for the representative on this specific dossier">75</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Score for the representative on this specific dossier">75</span>
</span>
</a>
---
<a aria-controls="dossier-15407" aria-expanded="false" data-parent="#accordion-dossier" data-toggle="collapse" href="#dossier-15407" role="button">
Pouvoirs publics : prorogation de l'état d'urgence
<span class="pull-right">
<span class="badge" data-placement="left" data-toggle="tooltip" title="Score for the representative on this specific dossier">-90</span>
<span class="badge badge-danger" data-placement="left" data-toggle="tooltip" title="Score for the representative on this specific dossier">-90</span>
</span>
</a>
\ No newline at end of file
......@@ -11,7 +11,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-up text-danger" title="for"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'état d'urgence - Première lecture">-100</span>
<span class="badge badge-danger" data-placement="left" data-toggle="tooltip" title="Prorogation de l'état d'urgence - Première lecture">-100</span>
</td>
</tr>
---
......@@ -28,7 +28,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-up text-danger" title="for"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 108(rect) et 109(rect)">-10</span>
<span class="badge badge-danger" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 108(rect) et 109(rect)">-10</span>
</td>
</tr>
---
......@@ -37,7 +37,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 10 et 90">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 10 et 90">10</span>
</td>
</tr>
---
......@@ -46,7 +46,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 30">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 30">10</span>
</td>
</tr>
---
......@@ -55,7 +55,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 52">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 52">10</span>
</td>
</tr>
---
......@@ -64,7 +64,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 7 et 88">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 7 et 88">10</span>
</td>
</tr>
---
......@@ -73,7 +73,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 83">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 83">10</span>
</td>
</tr>
---
......@@ -82,7 +82,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 8 et 89">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 8 et 89">10</span>
</td>
</tr>
---
......@@ -91,7 +91,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 92">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Amdt 92">10</span>
</td>
</tr>
---
......@@ -100,7 +100,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation État d'Urgence - Amdt 97">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation État d'Urgence - Amdt 97">10</span>
</td>
</tr>
---
......@@ -109,7 +109,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Renvoi en comission">5</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - Renvoi en comission">5</span>
</td>
</tr>
---
......@@ -126,7 +126,7 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-down text-success" title="against"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - amendement 46">10</span>
<span class="badge badge-success" data-placement="left" data-toggle="tooltip" title="Prorogation de l'État d'Urgence - amendement 46">10</span>
</td>
</tr>
---
......@@ -135,6 +135,6 @@
<td><i class="fa fa-thumbs-down text-default" title="against"></i></td>
<td><i class="fa fa-thumbs-up text-danger" title="for"></i></td>
<td>
<span class="badge" data-placement="left" data-toggle="tooltip" title="Prorogation de l'état d'urgence - première lecture">-100</span>
<span class="badge badge-danger" data-placement="left" data-toggle="tooltip" title="Prorogation de l'état d'urgence - première lecture">-100</span>
</td>
</tr>
\ No newline at end of file
......@@ -386,8 +386,20 @@ iframe {
color: red;
}
.panel.panel-default .badge {
background-color: #487ED6
.badge {
font-weight: bold;
}
.badge {
background-color: #487ED6 !important;
}
.badge-success {
background-color: #76c979 !important;
}
.badge-danger {
background-color: #ab181d !important;
}
......
......@@ -22,7 +22,8 @@
<dl class="dl-horizontal">
<dt>{% trans "Score" %}</dt>
<dd>
<span class="badge" data-toggle="tooltip" data-placement="right" title="{% trans "Total score is the sum of score contributions for each of this representatives votes" %}">{{ representative.score.score }}</span>
{% trans "Total score is the sum of score contributions for each of this representatives votes" as tooltip%}
{{ representative.score.score|score_badge:tooltip }}
</dd>
<dt>{% trans "Country" %}</dt>
......
......@@ -17,7 +17,8 @@
<a role="button" data-toggle="collapse" data-parent="#accordion-dossier" href="#dossier-{{ pk }}" aria-expanded="false" aria-controls="dossier-{{ pk }}">
{{ dossier.title }}
<span class="pull-right">
<span class="badge" data-toggle="tooltip" data-placement="left" title="{% trans "Score for the representative on this specific dossier" %}">{{ d.score }}</span>
{% trans "Score for the representative on this specific dossier" as tooltip %}
{{ d.score|score_badge:tooltip }}
</span>
</a>
</h4>
......@@ -45,7 +46,7 @@
<td>{{ vote.proposal.recommendation.recommendation|position_icon }}</td>
<td>{{ vote.position|position_icon:vote.proposal.recommendation.recommendation }}</td>
<td>
<span class="badge" data-toggle="tooltip" data-placement="left" title="{{ vote.proposal.recommendation.title }}">{{vote.score }}</span>
{{ vote.score|score_badge:vote.proposal.recommendation.title }}
</td>
</tr>
{% endfor %}
......
......@@ -48,7 +48,7 @@
<a class="icon-badge" href="{% group_url representative.main_mandate.group %}" title="{{ representative.main_mandate.group.name }}">{{ representative.main_mandate.group|group_icon }}</a>
{% endif %}
</p>
<p class="text-right"><span class="badge">{{ representative.score.score }}</span></p>
<p class="text-right">{{ representative.score.score|score_badge }}</p>
</div>
</div>
......
Supports Markdown
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