From 890f515d0347caf262dc7a160d0b006cc8e37875 Mon Sep 17 00:00:00 2001
From: Nicolas Joyard <joyard.nicolas@gmail.com>
Date: Fri, 17 Jun 2016 22:54:43 +0200
Subject: [PATCH] Enhance CSV button

---
 .../RepresentativeListTest.test_filter_chamber.content        | 4 ++--
 .../RepresentativeListTest.test_filter_country.content        | 4 ++--
 .../RepresentativeListTest.test_filter_group.content          | 4 ++--
 .../RepresentativeListTest.test_filter_multiple.content       | 4 ++--
 .../RepresentativeListTest.test_filter_notfound.content       | 4 ++--
 .../RepresentativeListTest.test_filter_search.content         | 4 ++--
 ...istTest.test_page1_paginateby12_active_displaylist.content | 4 ++--
 ...veListTest.test_page1_paginateby12_all_displaylist.content | 4 ++--
 ...est.test_page1_paginateby12_displaylist_searchjoly.content | 4 ++--
 ...istTest.test_page1_paginateby24_active_displaygrid.content | 4 ++--
 ...veListTest.test_page1_paginateby24_all_displaygrid.content | 4 ++--
 ...tativeListTest.test_page2_paginateby12_displaylist.content | 4 ++--
 ...tativeListTest.test_page2_paginateby24_displaylist.content | 4 ++--
 templates/representatives/_filter_form.haml                   | 2 +-
 14 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content
index 267fce10..e43743c2 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_chamber.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?country=&amp;search=&amp;group=&amp;chamber=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_country.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_country.content
index ee177705..4d3da60e 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_country.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_country.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?country=110&amp;search=&amp;group=&amp;chamber=&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_group.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_group.content
index 4e675674..2143b364 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_group.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_group.content
@@ -146,9 +146,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?country=&amp;search=&amp;group=17&amp;chamber=&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content
index d78219af..c7ad17e3 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_multiple.content
@@ -146,9 +146,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?country=110&amp;search=e&amp;group=17&amp;chamber=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_notfound.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_notfound.content
index 07ed02ac..36bed4ed 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_notfound.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_notfound.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?country=&amp;search=non-existing-rep-name&amp;group=&amp;chamber=&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_search.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_search.content
index e1de9412..5f674157 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_search.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_filter_search.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?country=&amp;search=am&amp;group=&amp;chamber=&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_active_displaylist.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_active_displaylist.content
index 2e3fa8af..0250a093 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_active_displaylist.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_active_displaylist.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=&amp;page=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_all_displaylist.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_all_displaylist.content
index a7608864..84db20ac 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_all_displaylist.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby12_all_displaylist.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=&amp;page=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
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 6e845dfc..d9984e38 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
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=joly&amp;page=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_active_displaygrid.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_active_displaygrid.content
index 3477c9b0..3cb5bef4 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_active_displaygrid.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_active_displaygrid.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=&amp;page=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_all_displaygrid.content b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_all_displaygrid.content
index 522587ed..a2c53d55 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_all_displaygrid.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page1_paginateby24_all_displaygrid.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=&amp;page=1&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
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 16f90ead..294423ff 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby12_displaylist.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=&amp;page=2&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
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 a995482e..b6cb3a31 100644
--- a/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist.content
+++ b/memopol/tests/response_fixtures/RepresentativeListTest.test_page2_paginateby24_displaylist.content
@@ -145,9 +145,9 @@
   </div>
 
   <div class="form-group">
-    <a class='btn btn-primary' href='?search=&amp;page=2&csv'>
+    <button class='btn btn-default' type='submit' name='csv'>
       <span class="glyphicon glyphicon-download-alt"></span> Download as CSV
-    </a>
+    </button>
   </div>
 
 </form>
diff --git a/templates/representatives/_filter_form.haml b/templates/representatives/_filter_form.haml
index 1940d5fc..cebb07f2 100644
--- a/templates/representatives/_filter_form.haml
+++ b/templates/representatives/_filter_form.haml
@@ -10,6 +10,6 @@
   - endbuttons
 
   - buttons
-    %a{'href': '?{{ qs }}&csv', 'class': 'btn btn-primary'}
+    %button{'type': 'submit', 'name': 'csv', 'class': 'btn btn-default'}
       {% bootstrap_icon "download-alt" %} Download as CSV
   - endbuttons
-- 
GitLab