From c7e29b3cb16ecf10e9ef30b49e6627402723c303 Mon Sep 17 00:00:00 2001
From: James Polley <jp@jamezpolley.com>
Date: Sun, 3 Dec 2017 17:30:43 +1100
Subject: [PATCH] Don't try to initialise dataTable twice

Old code was initialising the dataTable twice - once in the parent
block and once in the child. This doesn't actually work and just
caused errors.

Switch to only initializing it once. Unfortunately this creates
copy-pasta :(
---
 .../reviews/result_notification.html          | 33 ++++++++++++++++---
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/pinaxcon/templates/symposion/reviews/result_notification.html b/pinaxcon/templates/symposion/reviews/result_notification.html
index 4fdfb8e5..12a6cbea 100644
--- a/pinaxcon/templates/symposion/reviews/result_notification.html
+++ b/pinaxcon/templates/symposion/reviews/result_notification.html
@@ -85,7 +85,10 @@
 {% endblock %}
 
 {% block extra_script %}
-{{ block.super }}
+<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/jszip-2.5.0/dt-1.10.16/b-1.4.2/b-colvis-1.4.2/b-flash-1.4.2/b-html5-1.4.2/b-print-1.4.2/cr-1.4.1/fc-3.2.3/fh-3.1.3/r-2.2.0/rg-1.0.2/datatables.min.css"/>
+<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
+<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
+<script type="text/javascript" src="https://cdn.datatables.net/v/bs/jszip-2.5.0/dt-1.10.16/b-1.4.2/b-colvis-1.4.2/b-html5-1.4.2/b-print-1.4.2/cr-1.4.1/fc-3.2.3/fh-3.1.3/r-2.2.0/rg-1.0.2/datatables.min.js"></script>
     <script type="text/javascript">
         (function($) {
             $.fn.actions = function(opts) {
@@ -155,9 +158,29 @@
             $("tr input.action-select").actions();
         });
         $('.dataTable').dataTable({
-          "drawCallback": function( settings ) {
-            $("tr input.action-select").actions();
-          }
-        });
+            "dom": "<'row'<'col-md-3'l><'col-md-3'B><'col-md-4'f>r>t<'row'<'col-md-3'i><'col-md-5'p>>",
+            "stateSave": true,
+            "lengthMenu": [[10, 50, 100, -1], [10, 50, 100, "All"]],
+            "drawCallback": function( settings ) {
+                $("tr input.action-select").actions();
+            },
+            "pageLength": 100,
+            "colReorder": true,
+            "buttons": [ {
+              extend: 'collection',
+              text: 'Export',
+              buttons: ["copy", "csv", "print"]
+            },
+            { extend: 'collection',
+              text: 'Columns',
+              buttons: [
+                { extend: 'columnsToggle',
+                  columns: '.toggle' },
+                { extend: 'columnToggle',
+                  text: 'Vote details',
+                  columns: '.votes'
+                }
+            ]
+        }]});
     </script>
 {% endblock %}