Bugzilla – Attachment 48474 Details for
Bug 15910
Move header search keep text JavaScript into staff-global.js
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15910 - Move header search keep text JavaScript into staff-global.js
Bug-15910---Move-header-search-keep-text-JavaScrip.patch (text/plain), 4.57 KB, created by
Jonathan Druart
on 2016-02-29 17:06:48 UTC
(
hide
)
Description:
Bug 15910 - Move header search keep text JavaScript into staff-global.js
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-29 17:06:48 UTC
Size:
4.57 KB
patch
obsolete
>From f7e77847d1b3b7229d94ea48408c1771b4baefd4 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 24 Feb 2016 12:18:01 -0500 >Subject: [PATCH] Bug 15910 - Move header search keep text JavaScript into > staff-global.js >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Bug 14189 added some global JavaScript to a new include file which is >included in doc-head-close.inc. Since it's included globally, there is >no reason not to move it to staff-global.js. This patch does so. > >To test, apply the patch and clear your browser cache if necessary. > >- Navigate to any page in the staff client which has multiple header > search tabs. >- Type something in one of the tabs. >- Switch tabs. Verify that your text was copied to the newly-displayed > form field. > >Followed test plan, works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../prog/en/includes/doc-head-close.inc | 3 --- > .../prog/en/includes/searchbox-keep-text.inc | 30 ---------------------- > koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js | 28 ++++++++++++++++++++ > 3 files changed, 28 insertions(+), 33 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/searchbox-keep-text.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >index c31932a..b47e9dd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc >@@ -85,6 +85,3 @@ > }); > </script> > [% END %] >- >-<!-- For keeping the text when navigating the search tabs --> >-[% INCLUDE 'searchbox-keep-text.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/searchbox-keep-text.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/searchbox-keep-text.inc >deleted file mode 100644 >index 3d7dbc2..0000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/searchbox-keep-text.inc >+++ /dev/null >@@ -1,30 +0,0 @@ >-<script type="text/javascript"> >-//<![CDATA[ >-function keep_text(clicked_index) { >- var searchboxes = document.getElementsByClassName("head-searchbox"); >- var persist = searchboxes[0].value; >- >- for (i = 0; i < searchboxes.length - 1; i++) { >- if (searchboxes[i].value != searchboxes[i+1].value) { >- if (i === searchboxes.length-2) { >- if (searchboxes[i].value != searchboxes[0].value) { >- persist = searchboxes[i].value; >- } else if (searchboxes.length === 2) { >- if (clicked_index === 0) { >- persist = searchboxes[1].value; >- } >- } else { >- persist = searchboxes[i+1].value; >- } >- } else if (searchboxes[i+1].value != searchboxes[i+2].value) { >- persist = searchboxes[i+1].value; >- } >- } >- } >- >- for (i = 0; i < searchboxes.length; i++) { >- searchboxes[i].value = persist; >- } >-} >-//]]> >-</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >index d915136..6049fbc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js >@@ -129,3 +129,31 @@ function playSound( sound ) { > } > document.getElementById("audio-alert").innerHTML = '<audio src="' + sound + '" autoplay="autoplay" autobuffer="autobuffer"></audio>'; > } >+ >+// For keeping the text when navigating the search tabs >+function keep_text(clicked_index) { >+ var searchboxes = document.getElementsByClassName("head-searchbox"); >+ var persist = searchboxes[0].value; >+ >+ for (i = 0; i < searchboxes.length - 1; i++) { >+ if (searchboxes[i].value != searchboxes[i+1].value) { >+ if (i === searchboxes.length-2) { >+ if (searchboxes[i].value != searchboxes[0].value) { >+ persist = searchboxes[i].value; >+ } else if (searchboxes.length === 2) { >+ if (clicked_index === 0) { >+ persist = searchboxes[1].value; >+ } >+ } else { >+ persist = searchboxes[i+1].value; >+ } >+ } else if (searchboxes[i+1].value != searchboxes[i+2].value) { >+ persist = searchboxes[i+1].value; >+ } >+ } >+ } >+ >+ for (i = 0; i < searchboxes.length; i++) { >+ searchboxes[i].value = persist; >+ } >+} >\ No newline at end of file >-- >2.7.0
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 15910
:
48364
|
48373
| 48474