Bugzilla – Attachment 177156 Details for
Bug 26553
Remove KohaTable (columns_settings.inc) and use kohaTable (datatables.js)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26553: Replace KohaTable with kohaTable - OPAC
Bug-26553-Replace-KohaTable-with-kohaTable---OPAC.patch (text/plain), 13.07 KB, created by
Jonathan Druart
on 2025-01-27 08:45:38 UTC
(
hide
)
Description:
Bug 26553: Replace KohaTable with kohaTable - OPAC
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-01-27 08:45:38 UTC
Size:
13.07 KB
patch
obsolete
>From 73174302a1c25dde19e040b2201bb16b98b27115 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 2 Dec 2024 11:55:53 +0100 >Subject: [PATCH] Bug 26553: Replace KohaTable with kohaTable - OPAC > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >JD Amended patch: replace wrong occurrences of "kohatable" with "kohaTable" >--- > .../en/modules/opac-course-details.tt | 29 ++++---- > .../en/modules/opac-course-reserves.tt | 33 ++++----- > .../bootstrap/en/modules/opac-detail.tt | 70 +++++++++++-------- > .../bootstrap/en/modules/opac-holdshistory.tt | 24 +++---- > .../en/modules/opac-readingrecord.tt | 31 ++++---- > .../en/modules/opac-search-history.tt | 26 +++---- > 6 files changed, 114 insertions(+), 99 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt >index 27836cf3c6a..4300a1ebb70 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-details.tt >@@ -126,20 +126,23 @@ > <script> > $(document).ready(function() { > table_settings = [% TablesSettings.GetTableSettings( 'opac', 'course_items', 'course-items-table', 'json' ) | $raw %]; >- KohaTable("#course-items-table", { >- "dom": '<"top"<"table_controls"f>>t', >- "sorting": [[ 1, "asc" ]], >- "language": { >- "search": "_INPUT_", >- "searchPlaceholder": _("Search course reserves") >+ $("#course-items-table").kohaTable( >+ { >+ dom: '<"top"<"table_controls"f>>t', >+ sorting: [[1, "asc"]], >+ language: { >+ search: "_INPUT_", >+ searchPlaceholder: _("Search course reserves"), >+ }, >+ responsive: { >+ details: { type: "column", target: -1 }, >+ }, >+ columnDefs: [ >+ { className: "dtr-control", orderable: false, targets: -1 }, >+ ], > }, >- "responsive": { >- "details": { "type": 'column',"target": -1 } >- }, >- "columnDefs": [ >- { "className": 'dtr-control', "orderable": false, "targets": -1 }, >- ], >- }, table_settings ); >+ table_settings >+ ); > }); > </script> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt >index ee3c7f95dfd..d701e521ec5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-course-reserves.tt >@@ -75,23 +75,24 @@ > <script> > $(document).ready(function() { > table_settings = [% TablesSettings.GetTableSettings( 'opac', 'course_list', 'course_reserves_table', 'json' ) | $raw %] >- KohaTable("#course_reserves_table", { >- "dom": '<"top"<"table_controls"f>>rt<"clear">', >- "sorting": [[ 1, "asc" ]], >- "asColumnDefs": [ >- { "aTargets": [ 1 ], "sType": "nsb-nse" }, >- ], >- "language": { >- "search": "_INPUT_", >- "searchPlaceholder": _("Search courses") >+ $("#course_reserves_table").kohaTable( >+ { >+ dom: '<"top"<"table_controls"f>>rt<"clear">', >+ sorting: [[1, "asc"]], >+ asColumnDefs: [{ aTargets: [1], sType: "nsb-nse" }], >+ language: { >+ search: "_INPUT_", >+ searchPlaceholder: _("Search courses"), >+ }, >+ responsive: { >+ details: { type: "column", target: -1 }, >+ }, >+ cColumnDefs: [ >+ { className: "dtr-control", orderable: false, targets: -1 }, >+ ], > }, >- "responsive": { >- "details": { "type": 'column',"target": -1 } >- }, >- "cColumnDefs": [ >- { "className": 'dtr-control', "orderable": false, "targets": -1 }, >- ], >- }, table_settings ); >+ table_settings >+ ); > }); > </script> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >index b77a00417cd..c00ea41edd5 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -1746,41 +1746,49 @@ > > var table_settings = [% TablesSettings.GetTableSettings( 'opac', 'biblio-detail', 'holdingst', 'json' ) | $raw %]; > >- KohaTable("#holdingst", { >- dom: '<"clearfix">t', >- "columnDefs": [ >- { "className": "dtr-control", "orderable": false, "targets": -1 } >- ], >- "bKohaColumnsUseNames": true, >- "responsive": { >- "details": { "type": 'column', "target": -1 } >- } >- }, table_settings); >- >- KohaTable("#otherholdingst", { >- dom: '<"clearfix">t', >- "columnDefs": [ >- { "className": "dtr-control", "orderable": false, "targets": -1 } >- ], >- "bKohaColumnsUseNames": true, >- "responsive": { >- "details": { "type": 'column', "target": -1 } >- } >- }, table_settings); >+ $("#holdingst").kohaTable( >+ { >+ dom: '<"clearfix">t', >+ columnDefs: [ >+ { className: "dtr-control", orderable: false, targets: -1 }, >+ ], >+ bKohaColumnsUseNames: true, >+ responsive: { >+ details: { type: "column", target: -1 }, >+ }, >+ }, >+ table_settings >+ ); >+ $("#otherholdingst").kohaTable( >+ { >+ dom: '<"clearfix">t', >+ columnDefs: [ >+ { className: "dtr-control", orderable: false, targets: -1 }, >+ ], >+ bKohaColumnsUseNames: true, >+ responsive: { >+ details: { type: "column", target: -1 }, >+ }, >+ }, >+ table_settings >+ ); > > var serial_table_settings = [% TablesSettings.GetTableSettings( 'opac', 'biblio-detail', 'subscriptionst', 'json' ) | $raw %]; > >- KohaTable("#subscriptionst", { >- dom: '<"clearfix">t', >- "sorting": [[ 1, "desc" ]], >- "bKohaColumnsUseNames": true, >- "responsive": { >- "details": { "type": 'column', "target": -1 } >+ $("#subscriptionst").kohaTable( >+ { >+ dom: '<"clearfix">t', >+ sorting: [[1, "desc"]], >+ bKohaColumnsUseNames: true, >+ responsive: { >+ details: { type: "column", target: -1 }, >+ }, >+ columnDefs: [ >+ { className: "dtr-control", orderable: false, targets: -1 }, >+ ], > }, >- "columnDefs": [ >- { "className": "dtr-control", "orderable": false, "targets": -1 } >- ], >- }, serial_table_settings); >+ serial_table_settings >+ ); > > var dTables = $("#holdingst,#subscriptionst,#otherholdingst"); > $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (event) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt >index cca64a62748..1eb0597e29d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt >@@ -185,18 +185,18 @@ > $('#sort').change(function() { > $('#sortform').submit(); > }); >- var table = KohaTable("#table_holdshistory", { >- "dom": '<"top"<"table_entries"i><"table_controls"fB>>t', >- "autoWidth": false, >- "sorting": [[4, 'desc']], >- "columnDefs": [ >- { "sType": "anti-the", "aTargets" : [ "anti-the" ] } >- ], >- "language": { >- "search": "_INPUT_", >- "searchPlaceholder": _("Search") >- } >- }); >+ var table = $("#table_holdshistory").kohaTable( >+ { >+ dom: '<"top"<"table_entries"i><"table_controls"fB>>t', >+ autoWidth: false, >+ sorting: [[4, "desc"]], >+ columnDefs: [{ sType: "anti-the", aTargets: ["anti-the"] }], >+ language: { >+ search: "_INPUT_", >+ searchPlaceholder: _("Search"), >+ }, >+ }, >+ ); > }); > </script> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt >index 24b95d3e5dc..9d8c6d6116c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt >@@ -231,21 +231,24 @@ > $('#sortform').submit(); > }); > >- var table = KohaTable("#readingrec", { >- "dom": '<"top"<"table_entries"i><"table_controls"fB>>t', >- "language": { >- "search": "_INPUT_", >- "searchPlaceholder": _("Search") >+ var table = $("#readingrec").kohaTable( >+ { >+ dom: '<"top"<"table_entries"i><"table_controls"fB>>t', >+ language: { >+ search: "_INPUT_", >+ searchPlaceholder: _("Search"), >+ }, >+ responsive: { >+ details: { type: "column", target: -1 }, >+ }, >+ columnDefs: [ >+ { className: "dtr-control", orderable: false, targets: [-1] }, >+ { visible: false, targets: [0] }, >+ { orderable: false, targets: [1] }, >+ ], > }, >- "responsive": { >- "details": {"type": 'column',"target": -1} >- }, >- "columnDefs": [ >- { "className": "dtr-control","orderable": false,"targets": [-1] }, >- { "visible": false, "targets": [0]}, >- { "orderable": false, "targets": [1]} >- ], >- }); >+ ); >+ > let table_dt = table.DataTable(); > > $("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >index 1d35a87e8f9..9bb6cb09d19 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt >@@ -294,24 +294,24 @@ > $(document).ready(function() { > // We show table ordered by descending dates by default > // (so that the more recent query is shown first) >- var table = KohaTable(".historyt", { >- "order": [[ 1, "desc" ]], >- "dom": '<"top"<"table_entries"><"table_controls"fB>>t', >- "columnDefs": [ >- { "targets": [ 0 ], "sortable": false, "searchable": false }, >- { "className": 'dtr-control', "orderable": false, "targets": -1 } >+ let history_tables = $(".historyt").kohaTable({ >+ order: [[1, "desc"]], >+ dom: '<"top"<"table_entries"><"table_controls"fB>>t', >+ columnDefs: [ >+ { targets: [0], sortable: false, searchable: false }, >+ { className: "dtr-control", orderable: false, targets: -1 }, > ], >- "language": { >- "search": "_INPUT_", >- "searchPlaceholder": _("Search") >+ language: { >+ search: "_INPUT_", >+ searchPlaceholder: _("Search"), > }, >- "responsive": { >- "details": { "type": 'column',"target": -1 } >+ responsive: { >+ details: { type: "column", target: -1 }, > }, > }); > >- $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) { >- table.DataTable().responsive.recalc(); >+ $('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (e) { >+ history_tables.DataTable().responsive.recalc(); > }); > > $(".CheckNone").click(function(e){ >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26553
:
175186
|
175187
|
175188
|
175189
|
175190
|
175191
|
175874
|
175875
|
175876
|
175877
|
175878
|
175879
|
176359
|
176360
|
176361
|
176362
|
176363
|
176364
|
176588
|
176589
|
176590
|
176591
|
177087
|
177088
|
177089
|
177090
|
177091
|
177092
|
177152
|
177153
|
177154
|
177155
|
177156
|
177157
|
177158
|
177234
|
177235
|
177236
|
177237
|
177238
|
177239
|
177240
|
177241
|
177242
|
177243
|
177246
|
177247
|
177264
|
177265
|
177271
|
177888
|
177889
|
177890
|
177891
|
177892
|
177893
|
177894
|
177895
|
177896
|
177897
|
177898
|
177899
|
177900
|
178508
|
178509
|
178510
|
178511
|
178512
|
178513
|
178514
|
178515
|
178516
|
178517
|
178518
|
178519
|
178520
|
178521
|
178522
|
178523
|
178524
|
178525
|
178526
|
178527
|
178528
|
178529
|
178530
|
178531
|
178532
|
178533