From 4ad852c15e9cb09dced199674b55e9b2bbd1b2a1 Mon Sep 17 00:00:00 2001
From: Alice Heaton <aliceh@aptivate.org>
Date: Tue, 21 Jul 2015 11:07:23 +0100
Subject: [PATCH] Add extra markup for the checkbox so it can be themed

---
 django/website/hid/static/hid/js/select_all_checkbox.js | 2 +-
 django/website/hid/tables.py                            | 5 ++++-
 django/website/hid/templates/hid/custom_checkbox.html   | 9 +++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 django/website/hid/templates/hid/custom_checkbox.html

diff --git a/django/website/hid/static/hid/js/select_all_checkbox.js b/django/website/hid/static/hid/js/select_all_checkbox.js
index c0d68802..deb5dbcf 100644
--- a/django/website/hid/static/hid/js/select_all_checkbox.js
+++ b/django/website/hid/static/hid/js/select_all_checkbox.js
@@ -12,7 +12,7 @@
 (function($) {
     $(document).ready(function() {
         var selectors = {
-            td_input : 'form td.select_action > input',
+            td_input : 'form td.select_action input[type="checkbox"]',
             th_select : 'form th.select_action'
         };
 
diff --git a/django/website/hid/tables.py b/django/website/hid/tables.py
index d1b54e38..2e05bfe5 100644
--- a/django/website/hid/tables.py
+++ b/django/website/hid/tables.py
@@ -15,7 +15,10 @@ class ItemTable(tables.Table):
         template = 'hid/table.html'
         order_by = ('-created',)
 
-    select_action = NamedCheckBoxColumn(accessor='id', verbose_name='Select')
+    select_action = tables.TemplateColumn(
+        template_name='hid/custom_checkbox.html',
+        verbose_name='Select'
+    )
     created = tables.columns.DateTimeColumn(
         verbose_name='Imported',
         format=settings.SHORT_DATETIME_FORMAT,
diff --git a/django/website/hid/templates/hid/custom_checkbox.html b/django/website/hid/templates/hid/custom_checkbox.html
new file mode 100644
index 00000000..390e0cc5
--- /dev/null
+++ b/django/website/hid/templates/hid/custom_checkbox.html
@@ -0,0 +1,9 @@
+<div class='custom-checkbox'>
+    <input 
+        type='checkbox' 
+        id='custom-checkbox-{{ record.id }}' 
+        value='{{ record.id }}' 
+        name='delete'
+    />
+    <label for='custom-checkbox-{{ record.id }}'></label>
+</div>
-- 
GitLab