Bugzilla – Attachment 173479 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: External filter into state - catalogue concerns
Bug-33484-External-filter-into-state---catalogue-c.patch (text/plain), 8.08 KB, created by
Jonathan Druart
on 2024-10-28 09:46:30 UTC
(
hide
)
Description:
Bug 33484: External filter into state - catalogue concerns
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-10-28 09:46:30 UTC
Size:
8.08 KB
patch
obsolete
>From ac425f6d865c2161e30cb1780962effccb8efc97 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 17 Oct 2024 15:55:05 +0200 >Subject: [PATCH] Bug 33484: External filter into state - catalogue concerns > >Use a checkbox to store the state. It does not make the code better but >make possible to keep and restore and state of the filter. > >Not sure it's working correct on the cataloguing/concerns.pl page but >the behaviour was already not good before. >At least I think it fixes the filter/include icon in some situation. >On main I managed to get the "include resolved" link with the "filter" >icon and the resolved concerns were already displayed... > >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> >--- > .../prog/en/modules/catalogue/detail.tt | 13 +++++--- > .../prog/en/modules/cataloguing/concerns.tt | 32 +++++++++++-------- > 2 files changed, 27 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 7a00e941dcf..13fb0b04e63 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -781,6 +781,7 @@ > <fieldset class="action" style="cursor:pointer;"> > <a id="hideResolved"><i class="fa fa-minus-square"></i> Hide resolved</a> > | <a id="showAll"><i class="fa fa-bars"></i> Show all</a> >+ <input type="checkbox" id="hide_resolved_concerns" name="hide_resolved_concerns" style="display:none;" /> > </fieldset> > > <table id="table_concerns" width="100%"> >@@ -1228,10 +1229,9 @@ > $("#bibliodetails a:first").tab("show"); > var table_settings = [% TablesSettings.GetTableSettings( 'catalogue', 'concerns', 'table_concerns', 'json' ) | $raw %]; > >- var filtered = false; > let additional_filters = { > resolved_date: function(){ >- if ( filtered ) { >+ if ( $("#hide_resolved_concerns").is(":checked") ) { > return { "=": null }; > } else { > return; >@@ -1240,6 +1240,9 @@ > source: 'catalog', > biblio_id: [% biblionumber | uri %] > }; >+ let external_filter_nodes = { >+ hide_resolved_concerns: "#hide_resolved_concerns", >+ }; > > var tickets_url = '/api/v1/tickets'; > var tickets = $("#table_concerns").kohaTable({ >@@ -1350,15 +1353,15 @@ > "orderable": false > }, > ] >- }, table_settings, 0, additional_filters); >+ }, table_settings, 0, additional_filters, undefined, external_filter_nodes); > > $('#hideResolved').on("click", function() { >- filtered = true; >+ $("#hide_resolved_concerns").prop("checked", true); > tickets.DataTable().draw(); > }); > > $('#showAll').on("click", function() { >- filtered = false; >+ $("#hide_resolved_concerns").prop("checked", false); > tickets.DataTable().draw(); > }); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >index b1878fb0b95..a7452655fe5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >@@ -38,9 +38,11 @@ > > <div class="page-section"> > <fieldset class="action filters" style="cursor:pointer;"> >- <a id="resolved_filter" class="filtered"><i class="fa fa-bars"></i> Include resolved</a> >+ <a id="resolved_filter"><i class="fa fa-bars"></i> Include resolved</a> >+ <input type="checkbox" id="hide_resolved_concerns" style="display:none;" /> > [% FOR st IN status %] > | <a id="[% st.authorised_value | html %]_filter"><i class="fa fa-filter"></i> Filter [% st.lib | html %]</a> >+ <input type="checkbox" id="hide_[% st.authorised_value | html %]" style="display:none;" /> > [% END %] > </fieldset> > >@@ -81,10 +83,9 @@ > > var table_settings = [% TablesSettings.GetTableSettings('cataloguing', 'concerns', 'table_concerns', 'json') | $raw %]; > >- var filter_resolved = true; > let additional_filters = { > resolved_date: function(){ >- if ( filter_resolved ) { >+ if ( $("#hide_resolved_concerns").is(":checked") ) { > return { "=": null }; > } else { > return; >@@ -92,6 +93,9 @@ > }, > source: 'catalog' > }; >+ let external_filter_nodes = { >+ hide_resolved_concerns: "#hide_resolved_concerns", >+ }; > > var tickets_url = '/api/v1/tickets'; > var tickets = $("#table_concerns").kohaTable({ >@@ -204,25 +208,27 @@ > $(row).addClass(data.status.toLowerCase()); > } > }, >- }, table_settings, 1, additional_filters); >+ }, table_settings, 1, additional_filters, undefined, external_filter_nodes); > > var txtActivefilter = _("Include resolved"); > var txtInactivefilter = _("Filter resolved"); >- $('#resolved_filter').on("click", function() { >- if ($(this).hasClass('filtered')){ >- filter_resolved = false; >- $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter); >+ function adjust_filter_label(){ >+ if ($("#hide_resolved_concerns").is(":checked")){ >+ $("#resolved_filter").html('<i class="fa fa-filter"></i> '+txtActivefilter); > } else { >- filter_resolved = true; >- $(this).html('<i class="fa fa-bars"></i> '+txtInactivefilter); >+ $("#resolved_filter").html('<i class="fa fa-bars"></i> '+txtInactivefilter); > } >+ } >+ $('#resolved_filter').on("click", function() { >+ $("#hide_resolved_concerns").prop("checked", !$("#hide_resolved_concerns").is(":checked")); >+ adjust_filter_label() > tickets.DataTable().draw(); >- $(this).toggleClass('filtered'); > }); >+ adjust_filter_label(); > > [% FOR st IN status %] > $('#[% st.authorised_value | html %]_filter').on("click", function() { >- if ($(this).hasClass('filtered')){ >+ if ($("#hide_[% st.authorised_value | html %]").is(":checked")){ > additional_filters.status.find((o, i) => { > if (o["!="] === '[% st.authorised_value | html %]') { > additional_filters.status.splice(i, 1); >@@ -240,8 +246,8 @@ > additional_filters.status.push({ '!=': "[% st.authorised_value | html %]" }); > $(this).html('<i class="fa fa-bars"></i> '+_("Include ")+"[% st.lib | html %]"); > } >+ $("#hide_[% st.authorised_value | html %]").prop("checked", !$("#hide_[% st.authorised_value | html %]").is(":checked")); > tickets.DataTable().draw(); >- $(this).toggleClass('filtered'); > }); > [% END %] > }); >-- >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