Bugzilla – Attachment 172610 Details for
Bug 30221
Make the tables on opac-user.tt column configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30221: make the tables on opac-user.tt configurable
Bug-30221-make-the-tables-on-opac-usertt-configura.patch (text/plain), 16.40 KB, created by
Lucas Gass (lukeg)
on 2024-10-10 14:40:30 UTC
(
hide
)
Description:
Bug 30221: make the tables on opac-user.tt configurable
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-10-10 14:40:30 UTC
Size:
16.40 KB
patch
obsolete
>From d8bfe5dfacafd9075681f3c958d2361a1b63a0cd Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Thu, 26 Sep 2024 17:22:27 +0200 >Subject: [PATCH] Bug 30221: make the tables on opac-user.tt configurable > >Test plan: >- apply patch >- as an admin go to Administration / Table settings / Opac / Patron details >- hide a few columns (duedate, barcode) >- make a couple checkouts and/or holds for a patron >- login to the opac as this patron >- verify the tables on the patron account table is missing the selected columns > >sponsored-by: Lyon 2 University >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > admin/columns_settings.yml | 69 ++++++++++++ > .../en/includes/columns_settings.inc | 2 +- > .../bootstrap/en/includes/holds-table.inc | 18 +-- > .../bootstrap/en/modules/opac-user.tt | 106 +++++++----------- > 4 files changed, 120 insertions(+), 75 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 82548ed2c56..5a03b787e4d 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -2116,6 +2116,75 @@ modules: > - > columnname: link > >+ patron_details: >+ checkoutst: >+ columns: >+ - >+ columnname: title >+ - >+ columnname: author >+ - >+ columnname: datedue >+ - >+ columnname: itemtype >+ - >+ columnname: barcode >+ - >+ columnname: callnumber >+ - >+ columnname: renew >+ - >+ columnname: fines >+ - >+ columnname: links >+ holdst: >+ columns: >+ - >+ columnname: title >+ - >+ columnname: placed_on >+ - >+ columnname: expires_on >+ - >+ columnname: pickup_location >+ - >+ columnname: priority >+ - >+ columnname: notes >+ - >+ columnname: suspend >+ - >+ columnname: modify >+ overduest: >+ columns: >+ - >+ columnname: title >+ - >+ columnname: itemtype >+ - >+ columnname: barcode >+ - >+ columnname: callnumber >+ - >+ columnname: duedate >+ - >+ columnname: renew >+ - >+ columnname: fines >+ >+ opac_user_relative_issues_table: >+ columns: >+ - >+ columnname: title >+ - >+ columnname: duedate >+ - >+ columnname: barcode >+ - >+ columnname: callnumber >+ - >+ columnname: relative >+ > serials: > subscription-detail: > orders: >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >index 6fe51008c32..17b7bb041ed 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >@@ -87,7 +87,7 @@ function KohaTable(selector, dt_parameters, columns_settings) { > columns: included_ids, > className: "columns_controls", > titleAttr: _("Columns settings"), >- text: '<i class="fa fa-lg fa-gear" aria-hidden="true"></i> <span class="dt-button-text">' + _("Columns") + '</span>', >+ text: '<span class="dt-button-text">' + _("Columns") + '</span>', > exportOptions: { > columns: exportColumns > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >index a92c77b540d..f59138c086b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/holds-table.inc >@@ -8,28 +8,28 @@ > <!-- HOLDS TABLE ROWS --> > <thead> > <tr> >- <th class="all anti-the">Title</th> >+ <th data-colname="title" class="all anti-the">Title</th> > [% IF ( showpriority ) %] >- <th>Placed on</th> >+ <th data-colname="placed_on">Placed on</th> > [% ELSE %] >- <th class="psort">Placed on</th> >+ <th data-colname="placed_on" class="psort">Placed on</th> > [% END %] >- <th>Expires on</th> >+ <th data-colname="expires_on">Expires on</th> > [% UNLESS( singleBranchMode) %] >- <th>Pickup location</th> >+ <th data-colname="pickup_location">Pickup location</th> > [% END %] > [% IF ( showpriority ) %] >- <th class="psort">Priority</th> >+ <th data-colname="priority" class="psort">Priority</th> > [% END %] > [% IF Koha.Preference('OpacHoldNotes') %] >- <th>Notes</th> >+ <th data-colname="notes">Notes</th> > [% END %] > <th>Status</th> > [% IF SuspendHoldsOpac and ! onlyinfo %] >- <th class="nosort" >Suspend</th> >+ <th data-colname="suspend" class="nosort" >Suspend</th> > [% END %] > [% IF ! onlyinfo %] >- <th class="nosort">Modify</th> >+ <th data-colname="modify" class="nosort">Modify</th> > [% END %] > <th></th> > </tr> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 89e2b1dd0ad..5f842d31467 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -2,6 +2,7 @@ > [% USE Asset %] > [% USE Koha %] > [% USE KohaDates %] >+[% USE TablesSettings %] > [% USE Branches %] > [% USE ItemTypes %] > [% USE Price %] >@@ -332,28 +333,28 @@ > <thead> > <tr> > [% IF ( JacketImages ) %]<th class="nosort"> </th>[% END %] >- <th class="all anti-the">Title</th> >- <th>Author</th> >- <th class="psort">Due</th> >+ <th id="title" data-colname="title" class="all anti-the">Title</th> >+ <th id="author" data-colname="author">Author</th> >+ <th id="duedate" data-colname="datedue" class="psort">Due</th> > [% IF ( Koha.Preference('BiblioItemtypeInfo') || !item_level_itypes ) %] >- <th>Item type</th> >+ <th data-colname="itemtype">Item type</th> > [% END %] > [% IF ( show_barcode ) %] >- <th>Barcode</th> >+ <th data-colname="barcode">Barcode</th> > [% END %] >- <th>Call number</th> >+ <th data-colname="callnumber">Call number</th> > [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions_contains('renew') ) ) %] >- <th>Renew</th> >+ <th data-colname="renew">Renew</th> > [% END %] > [% IF ( OPACFinesTab ) %] >- <th>Fines</th> >+ <th data-colname="fines">Fines</th> > [% END %] > [% IF Koha.Preference('OPACMySummaryHTML') %] >- <th class="nosort">Links</th> >+ <th class="nosort" data-colname="links">Links</th> > [% END %] > [% IF ( Koha.Preference('AllowCheckoutNotes') ) %] > <th class="hidden">Checkout note</th> >- <th id="checkout-notes" class="nosort noExport" title="Use this to report any problems with your currently checked out items">Report a problem</th> >+ <th id="checkout-notes" class="nosort noExport" title="Use this to report any problems with your currently checked out items" data-colname="note">Report a problem</th> > [% END %] > <th></th> > </tr> >@@ -665,15 +666,15 @@ > > [% IF relatives %] > [% WRAPPER tab_panel tabname="opac-user-relative-issues" %] >- <table id="opac-user-relative-issues-table" class="table table-bordered table-striped"> >+ <table id="opac_user_relative_issues_table" class="table table-bordered table-striped"> > <caption class="sr-only">Relatives' checkouts</caption> > <thead> > <tr> >- <th class="all anti-the">Title</th> >- <th>Due</th> >- <th>Barcode</th> >- <th>Call number</th> >- <th class="psort">Relative</th> >+ <th data-colname="title" class="all anti-the">Title</th> >+ <th data-colname="duedate">Due</th> >+ <th data-colname="barcode">Barcode</th> >+ <th data-colname="callnumber">Call number</th> >+ <th data-colname="relative" class="psort">Relative</th> > <th></th> > </tr> > </thead> >@@ -720,16 +721,16 @@ > <thead> > <tr> > [% IF ( JacketImages ) %]<th class="nosort"> </th>[% END %] >- <th class="all anti-the">Title</th> >- [% UNLESS ( item_level_itypes ) %]<th>Item type</th> [% END %] >- [% IF ( show_barcode ) %]<th>Barcode</th>[% END %] >- <th>Call number</th> >- <th class="psort">Due</th> >+ <th data-colname="title" class="all anti-the">Title</th> >+ [% UNLESS ( item_level_itypes ) %]<th data-colname="itemtype">Item type</th> [% END %] >+ [% IF ( show_barcode ) %]<th data-colname="barcode">Barcode</th>[% END %] >+ <th data-colname="callnumber">Call number</th> >+ <th data-colname="duedate" class="psort">Due</th> > [% IF ( OpacRenewalAllowed ) %] >- <th class="nosort">Renew</th> >+ <th data-colname="renew" class="nosort">Renew</th> > [% END %] > [% IF ( OPACFinesTab ) %] >- <th>Fines</th> >+ <th data-colname="fines">Fines</th> > [% END %] > <th></th> > </tr> >@@ -1090,6 +1091,7 @@ > [% Asset.js("js/form-submit.js") | $raw %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'datatables.inc' %] >+ [% INCLUDE 'columns_settings.inc' %] > <script> > var AR_CAPTION_COUNT = _("(%s total)"); > >@@ -1217,52 +1219,26 @@ > ); > }); > >- var dTables = $("#checkoutst,#holdst,#overduest,#opac-user-relative-issues-table"); >- dTables.each(function(){ >- var thIndex = $(this).find("th.psort").index(); >- $(this).on("init.dt", function() { >- tableInit( $(this).attr("id") ); >- }) >- .dataTable($.extend(true, {}, dataTablesDefaults, { >- "sorting" : [[ thIndex, 'asc' ]], >- "dom": '<"top"<"table_entries"><"table_controls"fB>>t', >- "columnDefs": [ >- { "targets": [ "nosort" ],"sortable": false,"searchable": false }, >- { "type": "anti-the", "targets" : [ "anti-the" ] }, >- { "visible": false, "targets" : [ "hidden" ] }, >- { "className": 'dtr-control', "orderable": false, "targets": -1 } >- ], >+ function initKTable(id, columns_settings){ >+ KohaTable(id, { >+ "dom" : '<"top"<"table_entries"><"table_controls"fB>>t', >+ "bKohaColumnsUseNames": true, >+ "autoWidth": false, >+ "responsive": { >+ "details": { "type": 'column', "target": -1 } >+ }, > "language": { > "search": "_INPUT_", > "searchPlaceholder": _("Search") > }, >- "autoWidth": false, >- "responsive": { >- details: { >- type: 'column', >- target: -1 >- } >- }, >- buttons: [ >- /* Override default button set so that we can extend the options of print and csv */ >- 'clearFilter', 'copy', >- { >- extend: "print", >- exportOptions: { >- /* Print view should show all columns (even invisible ones) unless they are .noExport */ >- columns: ":not(.noExport)" >- } >- }, >- { >- extend: "csv", >- exportOptions: { >- /* CSV export should include all columns (even invisible ones) unless they are .noExport */ >- columns: ":not(.noExport)" >- } >- } >- ] >- })); >- }); >+ }, columns_settings); >+ } >+ >+ [% tables = ['checkoutst', 'holdst', 'overduest','opac_user_relative_issues_table'] %] >+ [% FOREACH table IN tables %] >+ var [% table | $raw %]_columns = [% TablesSettings.GetColumns( 'opac', 'patron_details', table, 'json') | $raw %]; >+ initKTable('#[% table | $raw %]', [% table | $raw %]_columns); >+ [% END %] > > var dataTables = $("#recalls-table,#article-requests-table"); > dataTables.each(function(){ >-- >2.39.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 30221
:
172214
|
172451
|
172452
|
172453
|
172454
|
172455
|
172456
|
172581
| 172610 |
172611
|
172613
|
172615
|
172616
|
172618
|
172620
|
174014
|
174015
|
174016
|
174046
|
174047
|
174048