Skip to main content

Module preview

Module preview 

Source
Expand description

Preview links that show a page as staged without logging in.

Modules§

page 🔒
token 🔒

Structs§

PagePreview
What the preview of a staged page, or of a published one, renders.
PreviewClaim
What a valid preview token lets its holder read without logging in: one page of a course, or all of its pages, as changeset_id stages them or as published.
PreviewExercise
An exercise of a previewed page.
PreviewPage
A page as students see it before answering anything. The preview needs no login, so exercise specs, model solutions and review settings other than the instructions are left out.
PreviewPageLink
A page a preview can switch to.
PreviewReference
A bibliography entry the page’s citations refer to.
PreviewToken
A preview link’s token and when it stops working.

Functions§

changed_page_links
The pages changeset adds or changes, in the order the staged course structure shows them.
mint_preview_token
Mints a short-lived preview token for the page page_id of the course, or for all its pages with None, as changeset_id stages them or published without one. Also deletes expired tokens.
preview_path
Path of the main frontend page that previews the staged changeset, for a token from mint_preview_token.
resolve_changeset_preview
What the preview link of the whole changeset renders: page_id, or the first changed page without one, with the changed pages to switch between. The caller checks the same things as for resolve_preview. Errors with NotFound also if the changeset changes no pages and page_id is None.
resolve_preview
What a preview link of page_id in changeset renders. The caller checks that the changeset is the link’s user’s and that they may still edit its course. Errors with NotFound if the changeset is no longer open or if the page does not exist in it or live.
resolve_published_course_preview
What the preview link of the whole published course renders: page_id, or the first page without one, with all pages to switch between. The caller checks the same things as for resolve_published_preview.
resolve_published_preview
What a preview link of the published page_id of course_id renders. The caller checks that the link’s user may still edit the course. Errors with NotFound if the page is not in the course.
validate_preview_token
Looks up an unexpired token. Errors with PreconditionFailed for an unknown or expired one.