Replace the Wikipedia citation dialog with an ol-popover
Summary
On edition pages (/books/OL…M), the "Wikipedia citation" link at the bottom of the page opens an old jQuery dialog with a <textarea> holding the {{cite book|…}} code. Replace it with an <ol-popover> that has a one-click copy button, and style the link and copy button like the ones on the Icons design page. Click any icon there to see the popover.
Where it lives
- Template:
openlibrary/templates/lib/exports.html. It renders the#wikilinktrigger (.dialog--open) and the hidden#wikicodedialog. - JS:
openlibrary/plugins/openlibrary/js/dialog.js(.dialog--open/.dialog--close), wired up injs/main.js - Data:
Edition.wp_citation_fieldsinopenlibrary/plugins/upstream/models.py. It only exists on editions, so the link only appears on/books/…URLs, not on work or author pages.
Reference implementation
- Popover and copy well: the
icon_popover()macro inopenlibrary/templates/design/icons.html.jinja - Styles:
.ds-icon-popover__*instatic/css/page-design.css. When you click, the copy glyph swaps for a check. - Copy handler:
openlibrary/plugins/openlibrary/js/design-system/index.js(data-ds-copy) - Popover component:
openlibrary/components/lit/OlPopover.js, documented under Popover on the Components design page (examples plus the API reference)
Acceptance criteria
- [ ] Clicking "Wikipedia citation" opens an
<ol-popover>anchored to the link, and a bottom tray on mobile. - [ ] The popover shows the
{{cite book|…}}code, a copy button with copied feedback, and the existing "Need help?" link to Wikipedia's Cite book template. - [ ] The link and copy button match the styling on the Icons page. Move shared styles out of
page-design.cssrather than reusingds-classes on book pages. - [ ] The citation wraps or scrolls legibly. It is much longer than an icon snippet.
- [ ] The old
#wikicodemarkup is removed. Leavedialog.jsalone, since other templates still use.dialog--open. - [ ] Keyboard works end to end: open, Tab to copy, Escape closes and focus returns to the link.
- [ ] Strings stay translatable, following
docs/ai/i18n.md.
Getting started
- Read
docs/ai/design.mdanddocs/ai/web-components.mdfirst. - Test on a local edition page, e.g.
http://localhost:8080/books/OL6M.
Hi @lokesh, I would like to work on this issue. I will replace the current Wikipedia citation dialog with the new ol-popover component and make sure the existing citation and copy functionality continues to work.
Go for it! Let me know if you have any questions.
can I also work on this or only one person is allowed?
@dproios just one person per Issue in the vast majority of cases. I'm going to be creating additional UI related issues this week so keep an eye out.