[Koha-patches] [PATCH] Bug 9445 - Use DataTables in local use system preferences editor

Owen Leonard oleonard at myacpl.org
Tue Jan 22 18:46:56 CET 2013


Replace the tablesorter plugin with the DataTables plugin in the
local use system preferences editor.

This patch moves embedding of the toolbar and table-sorting JS from
within the body of the page to the <head> for sake of consistency.

To test, open the system preferences editor to the Local Use tab.
Confirm that table sorting works correctly. In this configuration there
should be no pager and no results filtering.
---
 .../prog/en/modules/admin/systempreferences.tt     |   40 ++++++++++++--------
 1 file changed, 24 insertions(+), 16 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt
index 8e69259..ccaff3e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt
@@ -2,6 +2,30 @@
 <title>Koha › Administration › [% IF ( add_form ) %] System preferences › [% IF ( modify ) %]Modify system preference '[% searchfield %]'[% ELSE %]Add a system preference[% END %][% END %][% IF ( add_validate ) %] System preferences › Data added[% END %]
 [% IF ( delete_confirm ) %] System preferences › [% searchfield %] › Confirm deletion of parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System preferences › Parameter deleted[% END %][% IF ( else ) %]System preferences[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
+[% IF ( else ) %]
+<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
+<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>
+<script type="text/javascript">
+    //<![CDATA[
+    // prepare DOM for YUI Toolbar
+     $(document).ready(function() {
+        yuiToolbar();
+        [% IF ( loop ) %]$("#sysprefst").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "sDom": 't',
+            "aoColumnDefs": [
+                { "aTargets": [ -1, -2, -3, -4 ], "bSortable": false, "bSearchable": false }
+            ],
+            "bPaginate": false
+        }));[% END %]
+     });
+    // YUI Toolbar Functions
+    function yuiToolbar() {
+        new YAHOO.widget.Button("newstopword");
+    }   //]]>
+</script>
+[% END %]
 <script type="text/javascript">
 //<![CDATA[
 [% IF ( add_form ) %]
@@ -242,22 +266,6 @@
     [% IF ( else ) %]
     
     <div id="toolbar">
-    <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-    <script type="text/javascript">
-    //<![CDATA[
-    // prepare DOM for YUI Toolbar
-     $(document).ready(function() {
-        yuiToolbar();
-        [% IF ( loop ) %]$("#sysprefst").tablesorter({
-            sortList: [[0,0]],
-            headers: { 1: {sorter:false},2: { sorter: false },3: { sorter: false },4: { sorter: false }}
-        });[% END %]
-     });
-    // YUI Toolbar Functions
-    function yuiToolbar() {
-        new YAHOO.widget.Button("newstopword");
-    }   //]]>
-    </script>
     <ul class="toolbar">
         <li><a id="newstopword" href="[% script_name %]?op=add_form">New preference</a></li>
     </ul></div>
-- 
1.7.9.5


More information about the Koha-patches mailing list