From 1054bba00d559eb92891b9f1438a88b4e9672fb8 Mon Sep 17 00:00:00 2001 From: Nicolas Joyard <joyard.nicolas@gmail.com> Date: Thu, 2 Jun 2016 09:00:13 +0200 Subject: [PATCH] Add vote dates and sort by date --- .../RepresentativeDetailTest/test_votes_display.html | 12 ++++++++---- .../content | 2 +- .../content | 2 +- .../content | 2 +- .../content | 2 +- .../content | 2 +- memopol/views.py | 3 ++- static/less/legislature.less | 4 ++++ templates/representatives/representative_detail.haml | 3 +++ 9 files changed, 22 insertions(+), 10 deletions(-) diff --git a/memopol/tests/RepresentativeDetailTest/test_votes_display.html b/memopol/tests/RepresentativeDetailTest/test_votes_display.html index a87fb555..5767ab55 100644 --- a/memopol/tests/RepresentativeDetailTest/test_votes_display.html +++ b/memopol/tests/RepresentativeDetailTest/test_votes_display.html @@ -3,6 +3,7 @@ <table class='table table-condensed votes'> <tr> <th>Title</th> + <th>Date</th> <th class='icon-cell'> Memopol recommendation </th> @@ -17,14 +18,15 @@ <tr> <td>Stop acta !</td> + <td class='date-cell'>Nov.24,2010</td> <td class='icon-cell'> <i aria-label="for" class="fa fa-thumbs-up vote_positive" title="for" ></i> </td> <td class='icon-cell'> - <i aria-label="for" class="fa fa-thumbs-up vote_positive" title="for" ></i> + <i aria-label="against" class="fa fa-thumbs-down vote_negative" title="against" ></i> </td> <td class='icon-cell'> - <span class="label label-success">4</span> + <span class="label label-danger">-6</span> </td> @@ -32,6 +34,7 @@ <tr> <td>Stop acta !</td> + <td class='date-cell'>Nov.24,2010</td> <td class='icon-cell'> <i aria-label="for" class="fa fa-thumbs-up vote_positive" title="for" ></i> </td> @@ -47,14 +50,15 @@ <tr> <td>Stop acta !</td> + <td class='date-cell'>Nov.24,2010</td> <td class='icon-cell'> <i aria-label="for" class="fa fa-thumbs-up vote_positive" title="for" ></i> </td> <td class='icon-cell'> - <i aria-label="against" class="fa fa-thumbs-down vote_negative" title="against" ></i> + <i aria-label="for" class="fa fa-thumbs-up vote_positive" title="for" ></i> </td> <td class='icon-cell'> - <span class="label label-danger">-6</span> + <span class="label label-success">4</span> </td> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content index 64e881c0..67cb48d8 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist/content @@ -10,7 +10,7 @@ - The Political Memory of </title> - <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.66ec921b2740.css" type="text/css" /> + <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.3c5ffeab3cbf.css" type="text/css" /> <script type="text/javascript" src="/static/collected/libs/jquery/dist/jquery.js"></script> <script type="text/javascript" src="/static/collected/libs/bootstrap/dist/js/bootstrap.js"></script> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content index f164f6e0..3e96d141 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_displaylist_searchjoly/content @@ -10,7 +10,7 @@ - The Political Memory of </title> - <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.66ec921b2740.css" type="text/css" /> + <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.3c5ffeab3cbf.css" type="text/css" /> <script type="text/javascript" src="/static/collected/libs/jquery/dist/jquery.js"></script> <script type="text/javascript" src="/static/collected/libs/bootstrap/dist/js/bootstrap.js"></script> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content index c2af6dc3..788d295d 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_displaygrid/content @@ -10,7 +10,7 @@ - The Political Memory of </title> - <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.66ec921b2740.css" type="text/css" /> + <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.3c5ffeab3cbf.css" type="text/css" /> <script type="text/javascript" src="/static/collected/libs/jquery/dist/jquery.js"></script> <script type="text/javascript" src="/static/collected/libs/bootstrap/dist/js/bootstrap.js"></script> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content index 4afb6cfc..fbb2b4a8 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist/content @@ -10,7 +10,7 @@ - The Political Memory of </title> - <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.66ec921b2740.css" type="text/css" /> + <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.3c5ffeab3cbf.css" type="text/css" /> <script type="text/javascript" src="/static/collected/libs/jquery/dist/jquery.js"></script> <script type="text/javascript" src="/static/collected/libs/bootstrap/dist/js/bootstrap.js"></script> diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content index 0c50c3a3..f0e6eca8 100644 --- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content +++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist/content @@ -10,7 +10,7 @@ - The Political Memory of </title> - <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.66ec921b2740.css" type="text/css" /> + <link rel="stylesheet" href="/static/collected/libs/bootstrap/dist/css/bootstrap.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/fontawesome/css/font-awesome.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/libs/flag-icon-css/css/flag-icon.min.css" type="text/css" /><link rel="stylesheet" href="/static/collected/CACHE/css/base.3c5ffeab3cbf.css" type="text/css" /> <script type="text/javascript" src="/static/collected/libs/jquery/dist/jquery.js"></script> <script type="text/javascript" src="/static/collected/libs/bootstrap/dist/js/bootstrap.js"></script> diff --git a/memopol/views.py b/memopol/views.py index 8b7e4fa1..fb7ab10a 100644 --- a/memopol/views.py +++ b/memopol/views.py @@ -66,7 +66,8 @@ class RepresentativeDetail(representatives_views.RepresentativeDetail): 'votes', queryset=VoteScore.objects.filter( proposal__in=Proposal.objects.exclude(recommendation=None), - ).select_related('proposal__recommendation') + ).select_related('proposal__recommendation').order_by( + '-proposal__datetime') ) ) return qs diff --git a/static/less/legislature.less b/static/less/legislature.less index 90791aca..1c8c30db 100644 --- a/static/less/legislature.less +++ b/static/less/legislature.less @@ -36,6 +36,10 @@ color: #333; } +.date-cell { + white-space: nowrap; +} + .representative_grid { display: flex; flex-wrap: wrap; diff --git a/templates/representatives/representative_detail.haml b/templates/representatives/representative_detail.haml index 2d81ac86..8d3214cd 100644 --- a/templates/representatives/representative_detail.haml +++ b/templates/representatives/representative_detail.haml @@ -20,6 +20,7 @@ %table.table.table-condensed.votes %tr %th Title + %th Date %th.icon-cell Memopol recommendation %th.icon-cell @@ -30,6 +31,8 @@ - for vote in votes %tr %td= vote.proposal.recommendation.title + %td.date-cell + = vote.proposal.datetime|date:'N j, Y' %td.icon-cell = vote.proposal.recommendation.recommendation|position_icon %td.icon-cell -- GitLab