From 8859dc878f151004833a56850200db7561d1a227 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 2 Dec 2024 11:55:53 +0100 Subject: [PATCH] Bug 26553: Replace KohaTable with kohaTable - OPAC Signed-off-by: Lucas Gass JD Amended patch: replace wrong occurrences of "kohatable" with "kohaTable" Signed-off-by: Martin Renvoize --- .../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 | 2 +- .../en/modules/opac-readingrecord.tt | 31 ++++---- .../en/modules/opac-search-history.tt | 4 +- 6 files changed, 92 insertions(+), 77 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 053d647a487..89c82557aa2 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 @@ -139,20 +139,23 @@ [% 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 0059a7b0a44..9b96ddaadce 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 @@ -86,23 +86,24 @@ [% 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 13dd977d5e5..e263cabbd98 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1862,41 +1862,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 2d5c2c8184e..d69a150a207 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-holdshistory.tt @@ -185,7 +185,7 @@ $("#sort").change(function () { $("#sortform").submit(); }); - var table = KohaTable("#table_holdshistory", { + var table = $("#table_holdshistory").kohaTable({ dom: '<"top"<"table_entries"i><"table_controls"fB>>t', autoWidth: false, sorting: [[4, "desc"]], 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 0bb3612a5c1..cbd0ad43681 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt @@ -229,21 +229,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 6229d2dac89..cd9a3674ed7 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 @@ -295,7 +295,7 @@ $(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", { + let history_tables = $(".historyt").kohaTable({ order: [[1, "desc"]], dom: '<"top"<"table_entries"><"table_controls"fB>>t', columnDefs: [ @@ -312,7 +312,7 @@ }); $('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (e) { - table.DataTable().responsive.recalc(); + history_tables.DataTable().responsive.recalc(); }); $(".CheckNone").click(function (e) { -- 2.48.1