Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link olid macro #9348

Open
wants to merge 39 commits into
base: master
Choose a base branch
from

Conversation

psyren99
Copy link

@psyren99 psyren99 commented May 28, 2024

Closes #2283

Create a macro for linking to an OLID

Technical

/macros/OLID.html added
/plugins/upstream/models.py

Testing

/plugins/upstream/tests/test_models.py

Screenshot

Stakeholders

$def with (q="#")

$ edition = query_param('edition', q)
$ results = find_matches(olid, q)
Copy link
Member

@mekarpeles mekarpeles Jun 19, 2024

Choose a reason for hiding this comment

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

find_matches isn't a public function that's available here. It either needs to be passed in as a parameter, made a @public function, or be added to plugins/openlibrary/code.py as a template global: https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/openlibrary/code.py#L1146-L1171

I think though that find_matches is probably just the wrong function to use. We likely want to use some existing global function to do a web.ctx.site.things get for the specific olid (open library id)

@mekarpeles mekarpeles added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 19, 2024
@mekarpeles
Copy link
Member

@psyren99 please see code review comments, see if you can find a @public function anywhere that allows one to fetch a book by olid (openlibrary id). Otherwise, we'll have to create one, possibly in plugins/upstream/models.py

@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 30, 2024
@psyren99
Copy link
Author

Is this still open?

@mekarpeles
Copy link
Member

I believe this may need a rebase, then we can throw on testing and if it works, merge :)

@RayBB RayBB assigned mekarpeles and unassigned RayBB Jan 22, 2025
@RayBB
Copy link
Collaborator

RayBB commented Jan 22, 2025

@mekarpeles merge conflicts resolved.

@RayBB RayBB added the Needs: Staff / Internal Reviewed a PR but don't have merge powers? Use this. label Jan 22, 2025
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

There are accessibility issues in these changes.

$if(olid == q):
<a href="$edition.key">$title</a>
<h6>$edition.get_authors()</h6>
<img src="/books/add?work=$edition.key" />
Copy link

Choose a reason for hiding this comment

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

This image is missing a text alternative. This is a problem for people using screen readers.

Copy link
Author

Choose a reason for hiding this comment

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

included text alternative

$else:
<a href="$result">$olid</a>
<h6>$edition.get_authors()</h6>
<img src="/books/add?work=$olid" />
Copy link

Choose a reason for hiding this comment

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

This image is missing a text alternative. This is a problem for people using screen readers.

Copy link
Author

Choose a reason for hiding this comment

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

included text alternative

@psyren99 psyren99 force-pushed the 2283/linking_to_olid branch 2 times, most recently from 675f256 to 729729b Compare February 21, 2025 23:23
@RayBB
Copy link
Collaborator

RayBB commented Feb 21, 2025

@psyren99 looks like the linter is getting an error related to infogami. Can you try to merge the latest master branch into your branch and push that up? I think that should fix it.

@psyren99 psyren99 force-pushed the 2283/linking_to_olid branch from 4db6c98 to 21ab22b Compare February 22, 2025 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Staff / Internal Reviewed a PR but don't have merge powers? Use this.
Projects
Status: Waiting Review/Merge from Staff
Development

Successfully merging this pull request may close these issues.

Create a macro for linking to an OLID
4 participants