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

Replace cover URL validation with HTML attributes #8759

Conversation

rebecca-shoptaw
Copy link
Collaborator

Closes #8755

Refactor. Removes unnecessary/outdated js by handling URL validation with the "url" HTML attribute.

Technical

Very straightforward! Just a quick switch-out in the add.html file and removal of unnecessary url validation js from the covers.js file.

One quick note: This issue originally arose because I noticed that the val function was causing a type error (by trying to run .trim() on an empty string), which isn't directly fixed by this adjustment. Happy to add a quick fix for that -- confirming that $(#selector).val() is not an empty string before running .trim() on it -- to this PR or a separate one, but the fix may not be necessary.

Testing

  1. Go to a book page (while logged in)
  2. Select Add a Cover
  3. Try typing an invalid URL and hitting Submit

Screenshot

Invalid URL screenshot

Stakeholders

@cdrini

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Looks good! One small fix. Putting on testing.openlibrary.org to test now...

openlibrary/templates/covers/add.html Outdated Show resolved Hide resolved
@cdrini cdrini self-assigned this Jan 25, 2024
@cdrini cdrini added the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Jan 25, 2024
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

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

Lgtm! Tested uploading file, uploading via url, trying to upload bad url. All worked!

@cdrini cdrini merged commit 19ef1e0 into internetarchive:master Jan 25, 2024
4 checks passed
@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants