-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add want to read button to Search Page #5933
Conversation
f9dc6ca
to
c155561
Compare
</select> | ||
</form> | ||
$if ctx.user: | ||
<form method="POST" action="$(work.key)/bookshelves.json?debug=true" class="reading-log-lite $(searchPage)"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<form method="POST" action="$(work.key)/bookshelves.json?debug=true" class="reading-log-lite $(searchPage)"> | |
<form method="POST" action="$(work.key)/bookshelves.json" class="reading-log-lite $(form_classes)"> |
The debug
query parameter is not needed here.
</a> | ||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
</div> | |
</div> | |
Add newline to the end of the file.
<div class="dropit"> | ||
<div class="dropper on"> | ||
<div class="log-work"> | ||
<button class="unactivated" type="submit">$_('Want to Read')</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should be wrapped in a form, similar to the dropper on in the /lists/widget.html
template. This will ensure that patrons are directed to the login page when they press the button directly.
Login redirection will be handled by the bookshelf endpoint when this is inside of a form.
@@ -165,10 +166,12 @@ | |||
$for work in works: | |||
$ ocaid = work.ia[0] if work.ia else None | |||
$ availability = (work.get('availability') or {}).get('status') | |||
$ users_work_read_status = get_users_read_status(work, username) if work and username else None | |||
$ decorations = macros.ReadingLogButton(work, read_status=users_work_read_status, url=url, searchPage="searchPage") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ decorations = macros.ReadingLogButton(work, read_status=users_work_read_status, url=url, searchPage="searchPage") | |
$ decorations = macros.ReadingLogButton(work, read_status=users_work_read_status, url=url, form_classes="search-page") |
Update parameter name and use kebab-case
for HTML classes and ids.
@@ -96,6 +96,7 @@ export function initReadingListFeature() { | |||
// new shelf to the server and removing the associated item. | |||
// Note that any change to this select will result in the book changing | |||
// shelf. | |||
const $searchPage = $('.searchPage')[0] || null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const $searchPage = $('.searchPage')[0] || null | |
const $searchPage = $('.search-page')[0] || null |
@@ -104,7 +105,9 @@ export function initReadingListFeature() { | |||
}, | |||
datatype: 'json', | |||
success: function() { | |||
$self.closest('.searchResultItem').remove(); | |||
if ($searchPage===null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($searchPage===null) { | |
if (!$searchPage) { |
null
is falsy, so the condition can be simplified.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this is really close.
I'm noticing that it's not clear that a bookshelf has been changed when I select a new value from the drop-down. Can we add the check symbol to the newly selected shelf and remove it from the old shelf? This will probably have to be done via Javascript.
c155561
to
11f4a55
Compare
11f4a55
to
5054364
Compare
Added this by reloading only the |
Let's punt this for a bit. This component make sense to use on the reading log pages, as the item is removed from the list when the read status is changed. When this component is used in search results, the "Remove" option doesn't make sense. The checkmarks also need to be added when a new option is selected. Ideally, the book page "Want to Read" dropper component would be used for both search results and reading log page. Unfortunately, the Let's revisit this issue once there is a dedicated template for the "Want to Read" dropper. |
Closes #5501
This PR adds Want to Read Button to search results page.
Technical
ol.js
:Testing
Screenshot
User is not logged in:
User is logged in:
Stakeholders
@mekarpeles @jimchamp