Bugzilla – Attachment 173456 Details for
Bug 33484
Ability to remember user's selected table configuration and search filters for tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33484: (Bug 27467) Ability to share a link
Bug-33484-Bug-27467-Ability-to-share-a-link.patch (text/plain), 3.19 KB, created by
Jonathan Druart
on 2024-10-28 09:45:06 UTC
(
hide
)
Description:
Bug 33484: (Bug 27467) Ability to share a link
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-28 09:45:06 UTC
Size:
3.19 KB
patch
obsolete
>From e6d38bd4b319d98608ab18b126dad570d9f80e2d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 3 Oct 2024 15:02:58 +0200 >Subject: [PATCH] Bug 33484: (Bug 27467) Ability to share a link > >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 37 +++++++++++++++++-- > 1 file changed, 34 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 790f66e9b90..3186a7bf037 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -56,12 +56,13 @@ var dataTablesDefaults = { > "pageLength": 20, > "fixedHeader": true, > initComplete: function( settings ) { >- var tableId = settings.nTable.id >- var state = settings.oLoadedState; >+ var tableId = settings.nTable.id; >+ let table_node = $("#" + tableId); >+ >+ state = settings.oLoadedState; > state && state.search && toggledClearFilter(state.search.search, tableId); > > if (settings.ajax) { >- let table_node = $("#" + tableId); > if ( typeof this.api === 'function' ) { > _dt_add_delay(this.api(), table_node); > } else { >@@ -757,6 +758,28 @@ function _dt_buttons(params){ > } > ); > >+ buttons.push( >+ { >+ autoClose: true, >+ fade: 100, >+ className: "copyConditions_controls", >+ titleAttr: __("Copy conditions"), >+ text: '<i class="fa fa-lg fa-copy"></i> <span class="dt-button-text">' + __("Copy conditions") + '</span>', >+ action: function (e, dt, node, config) { >+ let state = JSON.stringify(dt.state()); >+ delete state.time; >+ let searchParams = new URLSearchParams(window.location.search); >+ let table_id = dt.table().node().id; >+ searchParams.set(table_id + '_state', btoa(state)); >+ let url = window.location.origin + window.location.pathname + '?' + searchParams.toString() + window.location.hash; >+ if( navigator.clipboard && navigator.clipboard.writeText){ >+ navigator.clipboard.writeText( url ); >+ // TODO Add tooltip "State copied to the clipboard" >+ } >+ }, >+ } >+ ); >+ > if ( table_settings && CAN_user_parameters_manage_column_config ) { > buttons.push( > { >@@ -952,6 +975,14 @@ function _dt_save_restore_state(table_settings){ > localStorage.setItem( table_key, JSON.stringify(data) ) > } > let stateLoadCallback = function(settings) { >+ >+ // Load state from URL >+ const url = new URL(window.location.href); >+ let state_from_url = url.searchParams.get( settings.nTable.id + '_state'); >+ if ( state_from_url ) { >+ return JSON.parse(atob(state_from_url)); >+ } >+ > if (!default_save_state) return {}; > > let state = localStorage.getItem(table_key); >-- >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 33484
:
149444
|
149445
|
149447
|
149448
|
149449
|
149925
|
149926
|
149927
|
149928
|
149929
|
149930
|
149974
|
149975
|
149976
|
149977
|
149978
|
149979
|
173443
|
173444
|
173445
|
173446
|
173447
|
173448
|
173449
|
173450
|
173451
|
173452
|
173453
|
173454
|
173455
| 173456 |
173457
|
173458
|
173459
|
173460
|
173461
|
173462
|
173463
|
173464
|
173465
|
173466
|
173467
|
173468
|
173469
|
173470
|
173471
|
173472
|
173473
|
173474
|
173475
|
173476
|
173477
|
173478
|
173479
|
173480
|
173481
|
173482
|
173483
|
173484
|
173485
|
173486
|
173546
|
173606
|
173607
|
173985
|
174219