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

made correction on reading logs page when no matches found #8812

Merged

Conversation

Ayush1404
Copy link
Contributor

Closes #8811

Searches on the reading log with no matches incorrectly show the "No books on this shelf" screen, this PR fixes it by showing correct error messages and other changes mentioned in issue #8811.

Technical

Testing

z
  1. Go to one of your reading log shelves (eg https://openlibrary.org/people/ScarTissue/books/already-read )
  2. Perform a search for something that won't match (eg "foo bar")
  3. See the output and then check thr search facility by going to "Search all of Open Library for "{query}"?" button .

Screenshot

Screenshot from 2024-02-11 00-13-57

Stakeholders

@cdrini

Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

Thanks @Ayush1404! Will be happy to merge this once the suggested changes have been made.

<input type="submit"/>
</form>
$ query = query_param('q')
<center>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<center>
<div class="center">

The <center> element has been deprecated since HTML 4.

$ query = query_param('q')
<center>
<hr>
<div class="red">$_("No results found in %s" %key) </div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<div class="red">$_("No results found in %s" %key) </div>
<div class="red">$_("No results found in this shelf") </div>

The value of key is not suitable for the UI, and no UI strings for shelf names are readily available in this template. Let's change the message to something that works more generally.

<div>
<a href="/search/inside?$urlencode(dict(q=query))">$_('Search all of Open Library for "%s"?' % query)</a>
</div>
</center>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
</center>
</div>
<div class="red">$_("No results found in %s" %key) </div>
<hr>
<div>
<a href="/search/inside?$urlencode(dict(q=query))">$_('Search all of Open Library for "%s"?' % query)</a>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<a href="/search/inside?$urlencode(dict(q=query))">$_('Search all of Open Library for "%s"?' % query)</a>
<a href="/search?$urlencode(dict(q=query))">$_('Search all of Open Library for "%s"?' % query)</a>

Use book search instead of full-text search.

@jimchamp jimchamp added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Feb 22, 2024
Comment on lines 75 to 78
<form method="GET" class="olform pagesearchbox">
<input type="text" minlength="3" placeholder="$_('Search your reading log')" name="q" value="$(query_param('q', ''))"/>
<input type="submit"/>
</form>
Copy link
Collaborator

@cdrini cdrini Feb 22, 2024

Choose a reason for hiding this comment

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

Oh also let's not duplicate this bit ; this appears higher up in the file, let's change the if statement up there.

@Ayush1404
Copy link
Contributor Author

Ayush1404 commented Feb 24, 2024

Hey @cdrini and @jimchamp, thank you very much for reviewing my code, I have made the necessary corrections that you suggested, can you please review if these are the changes you expected, thanks in advance :)

Copy link
Collaborator

@jimchamp jimchamp left a comment

Choose a reason for hiding this comment

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

Thanks @Ayush1404! Will commit my suggested change and merge this work.

openlibrary/templates/account/reading_log.html Outdated Show resolved Hide resolved
@jimchamp jimchamp merged commit a7d7b4a into internetarchive:master Feb 26, 2024
3 checks passed
@Ayush1404 Ayush1404 deleted the reading_log_no_match_correction branch March 1, 2024 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed]
3 participants