Bugzilla – Attachment 169527 Details for
Bug 33668
Add a 'clear search' button/icon inside the search input box on the OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33668: Added clear button to global js
Bug-33668-Added-clear-button-to-global-js.patch (text/plain), 2.24 KB, created by
Andreas Roussos
on 2024-07-24 23:38:15 UTC
(
hide
)
Description:
Bug 33668: Added clear button to global js
Filename:
MIME Type:
Creator:
Andreas Roussos
Created:
2024-07-24 23:38:15 UTC
Size:
2.24 KB
patch
obsolete
>From c823098dc03a92bdad90f7465105326b3aef1de4 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Tue, 23 Jul 2024 19:30:36 +0000 >Subject: [PATCH] Bug 33668: Added clear button to global js > >To test: >1. Apply the patch and perform a yarn build. >2. Navigate to the OPAC. > * Verify the presence of an X icon on the far right of the search box. >3. Perform the following steps: > * Type a search term (e.g., "Books") into the search box. > * Before clicking the search button or pressing 'Enter', click on the X icon. > * Note that the text ("Books") should be cleared from the search box. > * Repeat the above step, but this time complete the search. > * Verify that the search term remains in the search box. Clicking the X icon now should clear the text. >4. Confirm that searched terms persist in the Search history even after clearing a search. > * Terms cleared without completing a search should not appear in the history. >5. Sign off and have a great day! > >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >Signed-off-by: Andreas Roussos <a.roussos@dataly.gr> >--- > koha-tmpl/opac-tmpl/bootstrap/js/global.js | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js >index 694239e95a..715233b8ea 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js >@@ -251,7 +251,22 @@ var facetHandler = function (e) { > > function setPlaceholder(){ > let search_placeholder = $("#masthead_search option:selected").data("placeholder"); >- $("#translControl1").attr("placeholder", search_placeholder ); >+ let clearButton = $('<span class="clear-search"><i class="fa-sharp fa-regular fa-circle-xmark"></i></span>'); >+ >+ $("#translControl1").attr("placeholder", search_placeholder ).after(clearButton); >+ >+ clearButton.click(function() { >+ $("#translControl1").val('').focus(); >+ $(this).hide(); >+ }); >+ >+ $("#translControl1").on('input', function() { >+ if ($(this).val() !== '') { >+ clearButton.show(); >+ } else { >+ clearButton.hide(); >+ } >+ }); > } > > $(document).ready(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 33668
:
150602
|
169443
|
169444
|
169445
|
169446
|
169525
|
169526
|
169527
|
169528
|
169529
|
169530
|
169531
|
169532
|
169533
|
169534
|
169716
|
169717
|
169755
|
169756
|
169757
|
169758
|
169759
|
169760
|
169761