Bug 26248 - Simplify keep_text Javascript function
Summary: Simplify keep_text Javascript function
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: David Cook
QA Contact: Testopia
URL:
Keywords:
Depends on: 26249 14189
Blocks:
  Show dependency treegraph
 
Reported: 2020-08-19 05:13 UTC by David Cook
Modified: 2021-01-18 23:44 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 26248: Simplify keep_text function used in header search (2.50 KB, patch)
2020-08-19 05:16 UTC, David Cook
Details | Diff | Splinter Review
Example pendings on last-borrower (10.09 KB, image/png)
2020-08-23 16:44 UTC, Alvaro Cornejo
Details
Bug 26248: Simplify keep_text function used in header search (2.55 KB, patch)
2021-01-18 23:28 UTC, Mazen Khallaf
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2020-08-19 05:13:41 UTC
The keep_text function in koha-tmpl/intranet-tmpl/prog/js/staff-global.js is functional but not very readable.

We can simplify it.
Comment 1 David Cook 2020-08-19 05:16:43 UTC
Created attachment 108567 [details] [review]
Bug 26248: Simplify keep_text function used in header search

The current code is functional but not very readable. This patch
simplifies the code to be more readable and to be more efficient.

To test:
1) Apply patch
2) Refresh browser cache
3) Type "A" in "Check out" tab
4) Click "Check in" (and other tabs)
5) Observe that text is persisted from original tab
6) Type "B" in "Search the catalog" tab
7) Click "Renew" tab
8) Observe that text is persisted from latest changed tab
Comment 2 David Cook 2020-08-19 05:25:27 UTC
Hmm working fine on mainpage.pl but having an issue clicking on "Search the catalog" on search.pl...
Comment 3 David Cook 2020-08-19 05:35:53 UTC
For some reason that tab is passing an index value of 4 rather than 3...
Comment 4 David Cook 2020-08-19 05:41:25 UTC
Ahh the keep_text isn't set correctly in "koha-tmpl/intranet-tmpl/prog/en/includes/cat-search.inc"
Comment 5 David Cook 2020-08-19 05:47:55 UTC
Adding dependency on Bug 26249
Comment 6 Alvaro Cornejo 2020-08-23 16:44:44 UTC Comment hidden (obsolete)
Comment 7 Alvaro Cornejo 2020-08-23 16:47:26 UTC Comment hidden (obsolete)
Comment 8 Mazen Khallaf 2021-01-18 23:28:45 UTC
Created attachment 115262 [details] [review]
Bug 26248: Simplify keep_text function used in header search

The current code is functional but not very readable. This patch
simplifies the code to be more readable and to be more efficient.

To test:
1) Apply patch
2) Refresh browser cache
3) Type "A" in "Check out" tab
4) Click "Check in" (and other tabs)
5) Observe that text is persisted from original tab
6) Type "B" in "Search the catalog" tab
7) Click "Renew" tab
8) Observe that text is persisted from latest changed tab

Signed-off-by: Mazen Khallaf <mazen.i.khallaf@gamil.com>
Comment 9 Katrin Fischer 2021-01-18 23:42:20 UTC
I believe there is still a small glitch here:
When I 
- enter something in one tab
- move to the next
- empty the input field
- switch tab again
- the deleted string reappears
Comment 10 David Cook 2021-01-18 23:44:51 UTC
(In reply to Katrin Fischer from comment #9)
> I believe there is still a small glitch here:
> When I 
> - enter something in one tab
> - move to the next
> - empty the input field
> - switch tab again
> - the deleted string reappears

Hmm weird. I thought that I'd thoroughly tested this. 

I probably don't have time to work on this again for a long time, but that's a useful note!