From c24ee71c1e9c3c9f6a2f6abc582a9901dc088613 Mon Sep 17 00:00:00 2001
From: Nicolas Joyard <joyard.nicolas@gmail.com>
Date: Sat, 28 May 2016 17:53:50 +0200
Subject: [PATCH] Enhance dossier detail

---
 memopol/views.py                              |  2 +-
 .../representatives_votes/dossier_detail.haml | 61 +++++++++++--------
 2 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/memopol/views.py b/memopol/views.py
index ff734b4f..a3f1e8da 100644
--- a/memopol/views.py
+++ b/memopol/views.py
@@ -88,4 +88,4 @@ class DossierList(PaginationMixin, representatives_votes_views.DossierList):
         'proposals__recommendation'
     ).annotate(
         nb_recomm=Count('proposals__recommendation')
-    ).order_by('-reference')
+    ).order_by('-nb_recomm', '-reference')
diff --git a/templates/representatives_votes/dossier_detail.haml b/templates/representatives_votes/dossier_detail.haml
index 2237b973..6723a164 100644
--- a/templates/representatives_votes/dossier_detail.haml
+++ b/templates/representatives_votes/dossier_detail.haml
@@ -1,32 +1,43 @@
 - 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.position | position_icon
+        %td= proposal.status
+        %td= proposal.total_for
+        %td= proposal.total_against
+        %td= proposal.total_abstain
+
-- 
GitLab