-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Krist/be 503 new version request user is not redirected to the new (#234
) * added get_record_service_for_record * version bump * pagination html links * linked to __init__ and correcte typing --------- Co-authored-by: Ronald Krist <[email protected]>
- Loading branch information
1 parent
161818b
commit 608713f
Showing
4 changed files
with
31 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .links import pagination_links_html | ||
|
||
__all__ = ("pagination_links_html",) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from invenio_records_resources.services.base.links import Link | ||
|
||
def pagination_links_html(tpl: str)->dict[str, Link]: | ||
"""Create pagination links (prev/selv/next) from the same template.""" | ||
return { | ||
"prev_html": Link( | ||
tpl, | ||
when=lambda pagination, ctx: pagination.has_prev, | ||
vars=lambda pagination, vars: vars["args"].update( | ||
{"page": pagination.prev_page.page} | ||
), | ||
), | ||
"self_html": Link(tpl), | ||
"next_html": Link( | ||
tpl, | ||
when=lambda pagination, ctx: pagination.has_next, | ||
vars=lambda pagination, vars: vars["args"].update( | ||
{"page": pagination.next_page.page} | ||
), | ||
), | ||
} |
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