Bug 9445 [Revised] Use DataTables in local use system preferences editor origin/new/bug_9445
authorOwen Leonard <oleonard@myacpl.org>
Tue, 22 Jan 2013 17:37:08 +0000 (12:37 -0500)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sat, 2 Mar 2013 17:25:29 +0000 (12:25 -0500)
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.

Revision corrects template path to datatables assets.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Tab sorting works. No errors.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Further revision removes old tablesorter code
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/systempreferences.tt

index 51e7b8e..c26cbd8 100644 (file)
@@ -2,6 +2,24 @@
 <title>Koha &rsaquo; Administration &rsaquo; [% IF ( add_form ) %] System preferences &rsaquo; [% IF ( modify ) %]Modify system preference '[% searchfield %]'[% ELSE %]Add a system preference[% END %][% END %][% IF ( add_validate ) %] System preferences &rsaquo; Data added[% END %]
 [% IF ( delete_confirm ) %] System preferences &rsaquo; [% searchfield %] &rsaquo; Confirm deletion of parameter '[% searchfield %]'[% END %][% IF ( delete_confirmed ) %] System preferences &rsaquo; Parameter deleted[% END %][% IF ( else ) %]System preferences[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
+[% IF ( else ) %]
+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
+[% INCLUDE 'datatables-strings.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
+<script type="text/javascript">
+    //<![CDATA[
+     $(document).ready(function() {
+        [% IF ( loop ) %]$("#sysprefst").dataTable($.extend(true, {}, dataTablesDefaults, {
+            "sDom": 't',
+            "aoColumnDefs": [
+                { "aTargets": [ -1, -2, -3, -4 ], "bSortable": false, "bSearchable": false }
+            ],
+            "bPaginate": false
+        }));[% END %]
+     });
+</script>
+[% END %]
 <script type="text/javascript">
 //<![CDATA[
 [% IF ( add_form ) %]
 
         //]]>
 </script>
-[% IF ( else ) %]
-    <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-    <script type="text/javascript">
-    //<![CDATA[
-     $(document).ready(function() {
-        [% IF ( loop ) %]$("#sysprefst").tablesorter({
-            sortList: [[0,0]],
-            headers: { 1: {sorter:false},2: { sorter: false },3: { sorter: false },4: { sorter: false }}
-        });[% END %]
-     });
-    </script>
-[% END %]
 </head>
 <body id="admin_systempreferences" class="admin">
 [% INCLUDE 'header.inc' %]