-
-
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
refactors + adds sidebar to account settings #6427
Conversation
After this refactor PR lands, @tangym27 can follow the example of the Settings Page changes in this PR to also add this new sidebar to the patron Profile Page whose code lives in https://github.com/internetarchive/openlibrary/blob/master/openlibrary/templates/type/user/view.html |
I'm reviewing this now. Why was it converted to a draft? |
It was originally converted to draft because the code in books.html remained duplicated and has since been migrated into sidebar.html |
75b3ab6
to
6930dc5
Compare
Just worked through a final bug w/ @jimchamp re: selected List pages (by pulling the selected list key from the |
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.
Lgtm! Tested that sidebar bug has been resolved on testing.
$for lst in lists: | ||
$ list_id = lst.key.split('/')[-1] | ||
$ class_list = '' | ||
$if lst == items: |
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.
The sidebar is not rendering because it is missing items
, which is only used here to determine if the current list is selected:
In the list
context, items
is the list itself, which is probably overkill to send to the sidebar template. Maybe sending the list ID as the key
would work better:
$if lst == items: | |
$if list_id == key: |
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.
As an aside, it was wrong of me to name that parameter key
, as it doesn't fit the pattern of OL keys. Maybe selection
is better? Anyway, this doesn't need to be changed now.
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.
Anyway, you'll have to set the key for lists here:
openlibrary/openlibrary/plugins/upstream/mybooks.py
Lines 219 to 220 in 75b3ab6
elif self.key == 'list': | |
data = list |
Adding the following at the end of that block worked for me:
self.key = list.key.split('/')[-1]
Refactors the sidebar out of the account/books.html template and plugins/mybooks.py so that it can be added/used w/ the /account settings page.
Technical
NB: The old sidebar.html code is remains / is duplicated by this PR and needs to be consolidated + cleaned up in account/books.html templateTesting
Screenshot
Stakeholders
@jimchamp @cdrini