-
-
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 bulk delete, bulk archive/unarchive, and bulk metadata edit buttons in books table page #3113
base: master
Are you sure you want to change the base?
Conversation
f56f044
to
ab3d4e4
Compare
2a3bc12
to
96fb2c1
Compare
Let me know if I am missing anything. Fleshed out basically everything I can think of myself |
ebeb87f
to
a335dd7
Compare
@@ -350,6 +350,74 @@ def table_get_custom_enum(c_id): | |||
@edit_required | |||
def edit_list_book(param): |
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 moved the function to edit_book_param() in order to modularize it. This is so it can be used with the '/editselectedbooks/' calls. This essentially makes the change atomic from the client's perspective. Otherwise when bulk editing metadata, each metadata for each book needs an individual rest API call.
cps/kobo_sync_status.py
Outdated
@@ -54,10 +54,10 @@ def remove_synced_book(book_id, all=False, session=None): | |||
def change_archived_books(book_id, state=None, message=None): | |||
archived_book = ub.session.query(ub.ArchivedBook).filter(and_(ub.ArchivedBook.user_id == int(current_user.id), | |||
ub.ArchivedBook.book_id == book_id)).first() | |||
if not archived_book: | |||
if not archived_book and state == True: |
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.
Makes it so only requests to archive (ie state = true) actually creates an archivedbook listing.
Edit: Made line 57 if not archived_book and (state == True or state == None)
so state=None makes the function a toggler. Otherwise, not adding or state == None
will make it not create an archivedbook listing when someone tries to use the /togglearchived endpoint on a brand new, never-archived book
archived_book = ub.ArchivedBook(user_id=current_user.id, book_id=book_id) | ||
|
||
archived_book.is_archived = state if state else not archived_book.is_archived | ||
archived_book.is_archived = state if state != None else not archived_book.is_archived |
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.
Without this, bulk unarchiving on already-unarchived books will actually archive them instead. Without this, this function is just a toggler if state is false.
Same exact thing with edit_book_read_status is fixed in the commit below
@OzzieIsaacs This PR is ready to review now, whenever you're ready |
Do you know if this will be reviewed soon? @OzzieIsaacs |
I'll have a look at it. My request regarding buttons was a bit ambigious, the read/unread unarchive/archive ones should be radio buttons as on the user page. I'm feeling guilty for it, so I will change it by myself and I also will add the "select all" button. From the functionality it looks good |
This PR adds the following:
Screenshots below show the workflow for deleting for end-users, but is the same as for archive/unarching in bulk. Read comments below for more screenshots:
Select books
Delete books
Book list after deletion