Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Anthony
memopol
Commits
5666f0ba
Commit
5666f0ba
authored
Sep 07, 2016
by
Nicolas Joyard
Browse files
Add theme tags to dossiers in rep votes page
parent
d0cbef85
Changes
5
Hide whitespace changes
Inline
Side-by-side
memopol/tests/response_fixtures/RepresentativeVotesTest.test_dossiers.content
View file @
5666f0ba
<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 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 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 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
memopol/tests/test_representative_votes.py
View file @
5666f0ba
...
...
@@ -7,8 +7,9 @@ class RepresentativeVotesTest(RepresentativeBaseTest):
"""
- One for votes
- One for dossier scores
- Two for dossier themes (?? should be one according to the queryset !)
"""
queries
=
RepresentativeBaseTest
.
queries
+
2
queries
=
RepresentativeBaseTest
.
queries
+
4
def
test_queries
(
self
):
self
.
do_query_test
()
...
...
memopol/views/representative_detail_votes.py
View file @
5666f0ba
...
...
@@ -22,6 +22,8 @@ class RepresentativeDetailVotes(RepresentativeDetailBase):
'vote_score'
,
'proposal__dossier'
,
'proposal__recommendation'
).
prefetch_related
(
'proposal__dossier__themes'
).
order_by
(
'-proposal__datetime'
,
'proposal__title'
)
),
'dossier_scores'
...
...
@@ -39,10 +41,11 @@ class RepresentativeDetailVotes(RepresentativeDetailBase):
dossier
=
vote
.
proposal
.
dossier
pk
=
dossier
.
pk
if
pk
not
in
dossiers
:
scores
=
[
s
.
score
for
s
in
ds
if
s
.
dossier_id
==
pk
]
dossiers
[
pk
]
=
{
'dossier'
:
dossier
,
'votes'
:
[],
'score'
:
[
s
.
score
for
s
in
ds
if
s
.
dossier_id
==
pk
][
0
]
'score'
:
score
s
[
0
]
if
len
(
scores
)
else
0
}
dossiers
[
pk
][
'votes'
].
append
(
vote
)
...
...
static/css/custom.css
View file @
5666f0ba
...
...
@@ -387,6 +387,13 @@ iframe {
margin-bottom
:
5px
;
}
#accordion-dossier
h4
.panel-title
{
display
:
inline
;
}
#accordion-dossier
.panel-heading
.badge
{
margin-left
:
1em
;
}
/***************************************************************
Icones
...
...
templates/representatives/representative_detail_votes.html
View file @
5666f0ba
...
...
@@ -22,12 +22,14 @@
<h4
class=
"panel-title"
>
<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"
>
{% trans "Score for the representative on this specific dossier" as tooltip %}
{{ d.score|score_badge:tooltip }}
</span>
</a>
</h4>
<span
class=
"pull-right"
>
{% include "blocks/_themetags.html" with themes=dossier.themes.all %}
{% trans "Score for the representative on this specific dossier" as tooltip %}
{{ d.score|score_badge:tooltip }}
</span>
</div>
<div
id=
"dossier-{{ pk }}"
class=
"panel-collapse collapse"
role=
"tabpanel"
aria-labelledby=
"dossier-heading-{{ pk }}"
>
<div
class=
"panel-body"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment