From 4ae5ac4c770b32e41b69671e36801f1af7e858aa Mon Sep 17 00:00:00 2001 From: Nicolas Joyard <joyard.nicolas@gmail.com> Date: Tue, 5 Jul 2016 22:01:39 +0200 Subject: [PATCH] Add 'no recommendation' label to dossier detail and #proposals to dossier list --- memopol/views/dossier_list.py | 1 + static/scss/table.scss | 5 +++++ templates/representatives_votes/dossier_detail.haml | 11 +++++++++-- templates/representatives_votes/dossier_list.haml | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/memopol/views/dossier_list.py b/memopol/views/dossier_list.py index 48087409..ac3c4470 100644 --- a/memopol/views/dossier_list.py +++ b/memopol/views/dossier_list.py @@ -17,6 +17,7 @@ class DossierList(PaginationMixin, generic.ListView): 'proposals', 'proposals__recommendation' ).annotate( + nb_proposals=Count('proposals'), nb_recomm=Count('proposals__recommendation') ).order_by('-nb_recomm', '-reference') diff --git a/static/scss/table.scss b/static/scss/table.scss index b4a4c0df..106ae249 100644 --- a/static/scss/table.scss +++ b/static/scss/table.scss @@ -17,4 +17,9 @@ table.detail-view { .grid-list-selector { // text-align: right; +} + +.no-recommendation { + font-style: italic; + text-align: center; } \ No newline at end of file diff --git a/templates/representatives_votes/dossier_detail.haml b/templates/representatives_votes/dossier_detail.haml index 6c043157..08fa4aed 100644 --- a/templates/representatives_votes/dossier_detail.haml +++ b/templates/representatives_votes/dossier_detail.haml @@ -34,8 +34,15 @@ %small {{ proposal.reference }} {{ proposal.kind }} - %td= proposal.recommendation.title - %td= proposal.recommendation.recommendation | position_icon + + - if proposal.recommendation + + %td= proposal.recommendation.title + %td= proposal.recommendation.recommendation | position_icon + + - else + %td.no-recommendation{colspan:2}= "No recommendation" + %td= proposal.status %td= proposal.total_for %td= proposal.total_against diff --git a/templates/representatives_votes/dossier_list.haml b/templates/representatives_votes/dossier_list.haml index aed6045f..215aef3a 100644 --- a/templates/representatives_votes/dossier_list.haml +++ b/templates/representatives_votes/dossier_list.haml @@ -29,6 +29,8 @@ - trans "Title" %th - trans "Recommendations" + %th + - trans "Proposals" %th - trans "Reference" @@ -38,6 +40,7 @@ %a{'href': "{% url 'dossier-detail' dossier.pk %}"} {{ dossier.title }} %td= dossier.nb_recomm + %td= dossier.nb_proposals %td= dossier.reference - include "core/blocks/pagination.html" -- GitLab