Bug 33585 - Remove javascript code duplication in shelf browser
Summary: Remove javascript code duplication in shelf browser
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-21 15:41 UTC by Virgil Dupras
Modified: 2023-04-21 15:43 UTC (History)
0 users

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Initial patch (4.87 KB, patch)
2023-04-21 15:41 UTC, Virgil Dupras
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Virgil Dupras 2023-04-21 15:41:51 UTC
Created attachment 150056 [details] [review]
Initial patch

The handling of JS "previous" and "next" links in the shelf browser duplicate non-trivial code, which increases the chances for accidental bugs and makes the integration of other cover providers harder than it should (that is, duplication is propagated to each further provider).

This patch removes that duplication by harmonizing the "itemnumber" data element attached to the buttons and by making the jquery selector apply to both buttons at once.

Test Plan:

1) Apply patch.
2) Open the detail page of a document with enough adjacent documents to have a more-than-full shelf.
3) Open the shelf for the document. 
4) Click previous and check that the handler still does its thing as expected.
5) Same thing for Next.

I'm new to Koha (and perl) and its development workflow, I hope that this bug report doesn't break too many rules.