Bugzilla – Attachment 181526 Details for
Bug 39600
Use the API to render the OPAC ILL requests table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39600: Adapt template and use kohaTable
Bug-39600-Adapt-template-and-use-kohaTable.patch (text/plain), 4.90 KB, created by
HKS3 Tadeusz Sośnierz
on 2025-04-25 12:50:00 UTC
(
hide
)
Description:
Bug 39600: Adapt template and use kohaTable
Filename:
MIME Type:
Creator:
HKS3 Tadeusz Sośnierz
Created:
2025-04-25 12:50:00 UTC
Size:
4.90 KB
patch
obsolete
>From 7d73ec1f010ec51c13416fef8cb44235c5b443d1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 24 Apr 2025 10:02:58 -0300 >Subject: [PATCH] Bug 39600: Adapt template and use kohaTable >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch makes changes to the table introduced in the original patch: > >* It gets rendered using `kohaTable` instead of manually crafting the datatable >* Embeds are parameters for `kohaTable` thus no need to build the > headers manually >* A default render method is introduced, which HTML-escapes the data for > safety, and also deals with `null` values which could cause problems. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Tadeusz âtadzikâ SoÅnierz <tadeusz@sosnierz.com> >--- > .../bootstrap/en/modules/opac-illrequests.tt | 66 +++++-------------- > 1 file changed, 18 insertions(+), 48 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >index 0c0c2b906d..6067cb2e2f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -372,14 +372,24 @@ > > return status_label; > } >- $("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, { >+ $("#illrequestlist").kohaTable({ >+ order: [[ 0, "desc" ]], >+ dom: '<"dt-info"i><"top pager"<"table_entries"lp>>tr<"bottom pager"ip>', >+ paging: true, >+ embed: ['+strings','extended_attributes'], >+ ajax: { url: '/api/v1/public/patrons/[% logged_in_user.borrowernumber | uri %]/ill/requests' }, >+ columnDefs: [ { >+ render: function (data, type, row, meta) { >+ if ( data && type == 'display' ) { >+ return data.escapeHtml(); >+ } >+ return data; >+ } >+ } ], > columns: [ > { > data: 'ill_request_id', >- sortable: true, >- render: (data, type, row, meta) => { >- return data; >- }, >+ sortable: true > }, > { > data: 'author', >@@ -397,10 +407,7 @@ > }, > { > data: 'ill_backend_id', >- sortable: true, >- render: (data, type, row, meta) => { >- return escape_str(data); >- }, >+ sortable: true > }, > { > data: 'type', >@@ -437,45 +444,8 @@ > return `<a href="/cgi-bin/koha/opac-illrequests.pl?op=view&illrequest_id=${row.ill_request_id}" class="btn btn-primary btn-sm">View</a>`; > }, > } >- ], >- "order": [[ 0, "desc" ]], >- "dom": '<"dt-info"i><"top pager"<"table_entries"lp>>tr<"bottom pager"ip>', >- "paging": true, >- "serverSide": true, >- "ajax": { >- "cache": true, >- "url": '/api/v1/patrons/[% logged_in_user.borrowernumber | html %]/ill/requests', >- 'beforeSend': function (xhr, settings) { >- this._xhr = xhr; >- xhr.setRequestHeader('x-koha-embed', '+strings,extended_attributes'); >- }, >- "data": (data, settings) => { >- const order = data.order[0]; >- const order_by = (order.dir == 'asc' ? '+' : '-') + 'me.' + data.columns[order.column].data; >- const page = Math.floor(data.start / data.length) + 1; >- return { >- _page: page, >- _per_page: data.length, >- _order_by: order_by, >- }; >- }, >- 'dataFilter': function (data, type) { >- const json = {data: JSON.parse(data)}; >- if (total = this._xhr.getResponseHeader('x-total-count')) { >- json.recordsTotal = total; >- json.recordsFiltered = total; >- } >- if (total = this._xhr.getResponseHeader('x-base-total-count')) { >- json.recordsTotal = total; >- } >- if (draw = this._xhr.getResponseHeader('x-koha-request-id')) { >- json.draw = draw; >- } >- >- return JSON.stringify(json); >- }, >- }, >- })); >+ ] >+ }); > $("#backend-dropdown-options").removeClass("nojs"); > [% IF services_json.length > 0 %] > var services = [% services_json | $raw %]; >-- >2.47.2
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 39600
:
180758
|
180759
|
180760
|
180761
|
180762
|
180763
|
180764
|
180778
|
180781
|
180785
|
180786
|
180787
|
180821
|
181132
|
181133
|
181134
|
181135
|
181437
|
181438
|
181439
|
181440
|
181441
|
181442
|
181443
|
181524
|
181525
|
181526
|
181532
|
181533
|
181534
|
181535
|
181536
|
181537
|
181538
|
181608
|
181652