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
Political Memory
memopol
Commits
eeb3b220
Commit
eeb3b220
authored
Jun 02, 2016
by
njoyard
Browse files
Merge pull request #77 from political-memory/feature-enhance-dossiers
Enhance dossiers views, fixes #70
parents
e28cbe1c
f4a50ef9
Changes
9
Hide whitespace changes
Inline
Side-by-side
memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content
View file @
eeb3b220
...
...
@@ -69,7 +69,7 @@
</li>
<li>
<a
href=
'/votes/dossier/'
>
Vote
s
Dossier
s
</a>
</li>
...
...
memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content
View file @
eeb3b220
...
...
@@ -69,7 +69,7 @@
</li>
<li>
<a
href=
'/votes/dossier/'
>
Vote
s
Dossier
s
</a>
</li>
...
...
memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content
View file @
eeb3b220
...
...
@@ -69,7 +69,7 @@
</li>
<li>
<a
href=
'/votes/dossier/'
>
Vote
s
Dossier
s
</a>
</li>
...
...
memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content
View file @
eeb3b220
...
...
@@ -69,7 +69,7 @@
</li>
<li>
<a
href=
'/votes/dossier/'
>
Vote
s
Dossier
s
</a>
</li>
...
...
memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content
View file @
eeb3b220
...
...
@@ -69,7 +69,7 @@
</li>
<li>
<a
href=
'/votes/dossier/'
>
Vote
s
Dossier
s
</a>
</li>
...
...
memopol/views.py
View file @
eeb3b220
# Project specific "glue" coupling of all apps
from
django.db
import
models
from
django.db.models
import
Count
from
core.views
import
GridListMixin
,
PaginationMixin
,
CSVDownloadMixin
from
representatives
import
views
as
representatives_views
...
...
@@ -82,4 +83,9 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail):
class
DossierList
(
PaginationMixin
,
representatives_votes_views
.
DossierList
):
queryset
=
Dossier
.
objects
.
exclude
(
proposals__recommendation
=
None
)
queryset
=
Dossier
.
objects
.
prefetch_related
(
'proposals'
,
'proposals__recommendation'
).
annotate
(
nb_recomm
=
Count
(
'proposals__recommendation'
)
).
order_by
(
'-nb_recomm'
,
'-reference'
)
templates/_header.haml
View file @
eeb3b220
...
...
@@ -34,4 +34,4 @@
-
trans
'Committees'
%li
%a
{
href:
"{% url 'representatives_votes:dossier-list' %}"
}
-
trans
'
Vote
s'
-
trans
'
Dossier
s'
templates/representatives_votes/dossier_detail.haml
View file @
eeb3b220
-
extends
"base.html"
-
load
i18n
-
load
representatives_votes_tags
-
block
content
%h2
=
dossier
.
name
%h3
=
dossier
.
title
%h1
{{ dossier.name }} {{ dossier.title }}
%p
<strong>
{{ dossier.reference }}
</strong>
%h3
Votes ({{dossier.proposals.count}})
-
for
proposal
in
dossier
.
proposals
.
all
%h4
{{ forloop.counter }}.
{{ proposal.recommendation.title }} -
{{ proposal.datetime }} -
{{ proposal.status }}
%p
{{ proposal.title }}
%small
{{ proposal.reference }}
{{ proposal.kind }}
{{ proposal.recommendation.description }}
%p
%h5
For : {{ proposal.total_for }}
%h5
Against : {{ proposal.total_against }}
%h5
Abstain : {{ proposal.total_abstain }}
%p
Participants : {{ proposal.representatives.count }}
%h2
-
trans
"Recommendations"
%table
.table
%tr
%th
-
trans
"Proposal"
%th
-
trans
"Title"
%th
-
trans
"Recommendation"
%th
-
trans
"Status"
%th
=
"for"
|
position_icon
%th
=
"against"
|
position_icon
%th
=
"abstain"
|
position_icon
-
for
proposal
in
dossier
.
proposals
.
all
%tr
%td
=
proposal
.
title
%br
%small
{{ proposal.reference }}
{{ proposal.kind }}
%td
=
proposal
.
recommendation
.
title
%td
=
proposal
.
recommendation
.
recommendation
|
position_icon
%td
=
proposal
.
status
%td
=
proposal
.
total_for
%td
=
proposal
.
total_against
%td
=
proposal
.
total_abstain
templates/representatives_votes/dossier_list.haml
View file @
eeb3b220
-
extends
"base.html"
-
load
i18n
-
block
content
%h1
Dossiers
%h1
-
trans
"Dossiers"
%table
.table
%tr
%th
-
trans
"Title"
%th
-
trans
"Recommendations"
%th
-
trans
"Reference"
-
for
dossier
in
object_list
%tr
%td
%a
{
'href'
:
"{{ dossier.get_absolute_url }}"
}
{{ dossier.title }}
%td
=
dossier
.
nb_recomm
%td
=
dossier
.
reference
-
include
"core/blocks/pagination.html"
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