-
-
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 pagination to user following/follower lists #9323
Merged
mekarpeles
merged 9 commits into
internetarchive:master
from
pidgezero-one:9283/feat/paginate-followers
May 29, 2024
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
70448c5
paginate following page
378a8ed
don't want to modify limit, right?
9db8efa
indents
4cd4ce6
Spacing
dab37b2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] df8baa1
fix error
pidgezero-one e7c84b5
give the correct number to pagination
pidgezero-one c2b5c90
prevent invalid pages
pidgezero-one 99faae5
add comment'
pidgezero-one File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
$def with (user, follows=None, manage=False) | ||
$def with (user, num_found, page, results_per_page, follows=None, manage=False) | ||
|
||
$if follows: | ||
$ username = user.key.split('/')[-1] | ||
$for follow in follows: | ||
<ul> | ||
<li class="follow-row"> | ||
<div class="follow-row--name"> | ||
<div class="follow-row--name"> | ||
$if follow['publisher'] == username: | ||
<a href="/people/$follow['subscriber']/books" class="username-avatar"><img src="/people/$follow['subscriber']/avatar" class="account-avatar">$follow['subscriber']</a> | ||
$else: | ||
<a href="/people/$follow['publisher']/books" class="username-avatar"><img src="/people/$follow['publisher']/avatar" class="account-avatar">$follow['publisher']</a> | ||
</div> | ||
<div> | ||
</div> | ||
<div> | ||
$if manage: | ||
$:macros.Follow(follow['publisher'], following=1) | ||
</div> | ||
</div> | ||
</li> | ||
</ul> | ||
<div class="pager"> | ||
$:macros.Pager(page, num_found, results_per_page) | ||
</div> | ||
$else: | ||
<p>$_("There is nothing to see here yet.")</p> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since the page is also used to calculate the offset, I validate it here and pass it into the template instead of defining in the template. The number of values being passed to the template is quite large, and this might not be totally necessary, but doing it this way lets me force invalid page values in the query param to default to page 1 (i.e. ?page=0, ?page=-1, ?page=aaaa all default to the first page) before using it to calculate the offset.