Skip to content

feat(books): rename Locate button to Check WorldCat and use Check Options for search/carousels - #12914

Open
Sadashii wants to merge 3 commits into
internetarchive:masterfrom
Sadashii:feat/rename-locate-to-worldcat
Open

feat(books): rename Locate button to Check WorldCat and use Check Options for search/carousels#12914
Sadashii wants to merge 3 commits into
internetarchive:masterfrom
Sadashii:feat/rename-locate-to-worldcat

Conversation

@Sadashii

@Sadashii Sadashii commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Closes #12105

This PR renames the "Locate" button to "Check WorldCat" on the book/edition page, and changes the label to "Check Options" (pointing back to the book/work page) in search results, carousels, and the editions table when a specific edition is unavailable.

Technical

  • Renamed the LocateButton.html macro to CheckWorldcat.html and changed user-facing string labels to Check WorldCat.
  • Created conditional logic inside LoanStatus.html:
    • edition_page=True (passed from the edition/work view template) renders the CheckWorldcat button.
    • When is_edition is True but it is not on the book page itself (e.g., search results, carousels, editions list), it renders a Check Options button linking to the work page ($work_key).
  • Retained the CTAClick|Locate telemetry event action for click analytics to avoid breaking historical dashboards.

Testing

  1. Run python template tests:
    uv run --with-requirements requirements_test.txt pytest openlibrary/tests/test_templates.py
  2. Run standard lint checks:
    npm run lint

Screenshot

image image

Stakeholders

@mekarpeles

@Sadashii
Sadashii force-pushed the feat/rename-locate-to-worldcat branch from 6df5639 to 0c15e4c Compare June 12, 2026 18:42
@Sadashii
Sadashii marked this pull request as ready for review June 12, 2026 18:45
Copilot AI review requested due to automatic review settings June 12, 2026 18:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates Open Library’s “read/locate” CTAs to use a WorldCat-oriented flow and adjusts LoanStatus behavior based on page context.

Changes:

  • Update LoanStatus call sites and signature to use edition_page context.
  • Replace “Locate” UI with “Check WorldCat” / “Check Options” CTAs in read-related macros.
  • Add new i18n strings for the updated CTA text.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
openlibrary/templates/books/edition-sort.html Updates LoanStatus invocation, removing the prior page-context flag.
openlibrary/macros/databarWork.html Passes new edition_page argument into LoanStatus.
openlibrary/macros/ReadButton.html Switches locate action to CheckWorldcat.
openlibrary/macros/LocateButton.html Renames displayed CTA copy to “Check WorldCat”.
openlibrary/macros/LoanStatus.html Changes macro signature and rewrites unavailable-state CTA logic.
openlibrary/i18n/messages.pot Adds i18n strings for new CTA labels and help text.

Comment thread openlibrary/macros/LoanStatus.html Outdated
Comment thread openlibrary/macros/LoanStatus.html
Comment thread openlibrary/macros/databarWork.html Outdated
Comment thread openlibrary/templates/books/edition-sort.html Outdated
Comment thread openlibrary/i18n/messages.pot
@Sadashii
Sadashii force-pushed the feat/rename-locate-to-worldcat branch 2 times, most recently from 6aec920 to a6ea98e Compare June 12, 2026 18:58
@mekarpeles mekarpeles self-assigned this Jun 15, 2026
@mekarpeles
mekarpeles force-pushed the feat/rename-locate-to-worldcat branch from 5a36336 to 7ebe139 Compare July 16, 2026 21:48
@openlibrary-bot

Copy link
Copy Markdown
Collaborator

👋 This branch was rebased onto current master to resolve merge conflicts, caused by #12910 merging in the meantime.

Why the conflict happened

#12910 ("show alternatives banner on unavailable book pages") merged just before this and heavily restructured openlibrary/macros/LoanStatus.html's conditional branches (moving from raw availability/book_provider checks to a single precomputed lending_state). Your branch renames LocateButton.htmlCheckWorldcat.html and touches the same file's final $else: fallback block (the "not available anywhere" case) plus ReadButton.html, databarWork.html, and edition-sort.html — all files #12910 also modified.

The real conflict, reconstructed from your branch's actual intent vs. what's now on master:

  1. LoanStatus.html def signaturemaster added lending_state=None; your branch renames the (previously declared-but-unused) is_book_page param to editions_page and starts actually reading it. Kept both: editions_page=False, ..., lending_state=None.
  2. The $else: fallback blockmaster's version was structurally unchanged from your branch's base (just dropped one dead $ key = doc.key if is_edition else work_key line), so your intended two-way is_editioneditions_page ? CheckWorldcat : "Check Options" restructuring applied cleanly on top, using the edition_key that #12910 now computes earlier in the file (so the redundant local recomputation was dropped too).
  3. databarWork.html — kept master's lending_state=lending_state and added your new editions_page=editions_page passthrough, so both PRs' additions to this call site survive.
  4. edition-sort.html — kept master's lending_state=lending_state, dropped is_book_page=render_first per your branch's own diff (you removed that kwarg entirely at this call site as part of the rename).
  5. messages.pot — regenerated fresh from the final rebased tree rather than hand-merged; only the LocateCheck options for this book. / Check Options string change survived, as expected.

Verified: git merge-tree against master is clean, make js builds with 0 errors, and I loaded a live book page in the dev environment to confirm LoanStatus.html renders correctly (200, no errors, "Check Options" link present).

Tip for next time: the earlier tip about rebasing periodically applies doubly here — this branch was open ~5 weeks and picked up drift not just from #12910 but from an unrelated earlier is_book_page param that had already gone dead/unused on master before your branch even started using it. Long-lived branches touching shared macros (LoanStatus.html, ReadButton.html) are worth rebasing every time a related PR merges, not just periodically.

No action needed — the branch is up to date with master and mergeable.

— PAM (Open Library's Project AI Manager)

@Sadashii
Sadashii force-pushed the feat/rename-locate-to-worldcat branch from 7ebe139 to 5492976 Compare July 17, 2026 07:13
@mekarpeles
mekarpeles force-pushed the feat/rename-locate-to-worldcat branch from 5492976 to cd7f888 Compare September 1, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Locate Button to navigate to Book Page section

4 participants