Bugzilla – Attachment 177158 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: Remove columns_settings.inc - OPAC
Bug-26553-Remove-columnssettingsinc---OPAC.patch (text/plain), 6.33 KB, created by
Jonathan Druart
on 2025-01-27 08:45:44 UTC
(
hide
)
Description:
Bug 26553: Remove columns_settings.inc - OPAC
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-01-27 08:45:44 UTC
Size:
6.33 KB
patch
obsolete
>From 64bae2913b56ec83812a52368e9af4a3a4c36503 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 2 Dec 2024 12:25:57 +0100 >Subject: [PATCH] Bug 26553: Remove columns_settings.inc - OPAC > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > .../en/includes/columns_settings.inc | 157 ------------------ > 1 file changed, 157 deletions(-) > delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >deleted file mode 100644 >index 0c5317adf90..00000000000 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc >+++ /dev/null >@@ -1,157 +0,0 @@ >-[% USE TablesSettings %] >- >-<script> >- >-function _dt_visibility(table_settings, table_dt){ >- let hidden_ids = []; >- if ( table_settings ) { >- var columns_settings = table_settings.columns; >- let i = 0; >- let use_names = $(table_dt.table().node()).data('bKohaColumnsUseNames'); >- if ( use_names ) { >- let hidden_columns = table_settings.columns.filter(c => c.is_hidden); >- if (!hidden_columns.length) return []; >- table_dt.columns(hidden_columns.map(c => "[data-colname='%s']".format(c.columnname)).join(',')).every(function(){ >- hidden_ids.push(this.index()); >- }); >- } else { >- $(columns_settings).each( function(i, c) { >- if ( c.is_hidden == '1' ) { >- hidden_ids.push(i); >- } >- }); >- } >- } >- return hidden_ids; >-} >- >-function KohaTable(selector, dt_parameters, table_settings) { >- >- // By default we include all visible columns in exports and print unless they have the "noExport" class >- var exportColumns = ":visible:not(.noExport)"; >- if( dt_parameters.hasOwnProperty("exportColumns") ){ >- // A custom buttons configuration has been passed from the page >- exportColumns = dt_parameters["exportColumns"]; >- } >- // Data which has the "noExport" class should not appear in print or export >- var export_format = { >- body: function ( data, row, column, node ) { >- var newnode = $(node); >- >- if ( newnode.find(".noExport").length > 0 ) { >- newnode = newnode.clone(); >- newnode.find(".noExport").remove(); >- } >- >- return newnode.text().replace( /\n/g, ' ' ).trim(); >- } >- } >- >- // Add a "Clear filter" button to table filter form field >- dt_parameters[ "buttons" ] = [ >- { >- fade: 100, >- className: "dt_button_clear_filter", >- titleAttr: _("Clear filter"), >- enabled: false, >- text: '<i class="fa fa-lg fa-times" aria-hidden="true"></i> <span class="dt-button-text">' + _("Clear filter") + '</span>', >- action: function ( e, dt, node, config ) { >- dt.search( "" ).draw("page"); >- node.addClass("disabled"); >- } >- }, >- { >- extend: 'csvHtml5', >- text: _("CSV"), >- exportOptions: { >- columns: exportColumns, >- format: export_format >- }, >- }, >- { >- extend: 'copyHtml5', >- text: _("Copy"), >- exportOptions: { >- columns: exportColumns, >- format: export_format >- }, >- }, >- { >- extend: 'print', >- text: _("Print"), >- exportOptions: { >- columns: exportColumns, >- format: export_format >- }, >- } >- ]; >- >- // Retrieving bKohaColumnsUseNames from the options passed to the constructor, not DT settings >- // But ideally should be retrieved using table.data() >- let use_names = dt_parameters.bKohaColumnsUseNames; >- let included_columns = []; >- if (table_settings) { >- if (use_names) { >- // bKohaColumnsUseNames is set, identify columns by their data-colname >- included_columns = table_settings.columns >- .filter(c => !c.cannot_be_toggled) >- .map(c => "[data-colname='%s']".format(c.columnname)) >- .join(","); >- } else { >- // Not set, columns are ordered the same than in the columns settings >- included_columns = table_settings.columns >- .map((c, i) => (!c.cannot_be_toggled ? i : null)) >- .filter(i => i !== null); >- } >- } >- >- if( included_columns.length > 0 ){ >- dt_parameters[ "buttons" ].push( >- { >- extend: 'colvis', >- fade: 100, >- columns: included_columns, >- 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>', >- exportOptions: { >- columns: exportColumns >- } >- } >- ); >- } >- >- var table = $(selector); >- >- var new_parameters = {} >- $.extend(true, new_parameters, dataTablesDefaults, dt_parameters); >- var default_column_defs = [ >- { "aTargets": ["string-sort"], "sType": "string" }, >- { "aTargets": ["anti-the"], "sType": "anti-the" }, >- { "aTargets": ["NoSort"], "bSortable": false, "bSearchable": false } >- ]; >- if (new_parameters["aoColumnDefs"] === undefined) { >- new_parameters["aoColumnDefs"] = default_column_defs; >- } else { >- $.extend(true, new_parameters, default_column_defs); >- } >- >- $(table).data('bKohaColumnsUseNames', dt_parameters.bKohaColumnsUseNames); >- >- table.dataTable(new_parameters); >- var table_dt = table.DataTable(); >- >- let hidden_ids = _dt_visibility(table_settings, table_dt); >- table_dt.on("column-visibility.dt", function () { >- if (typeof columnsInit == 'function') { >- // This function can be created separately and used to trigger >- // an event after the DataTable has loaded AND column visibility >- // has been updated according to the table's configuration >- columnsInit(); >- } >- }).columns(hidden_ids).visible(false); >- >- return table; >-} >- >-</script> >-- >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