page_tours.hints#
Declarations of hints: pointers on a page that open a popover when pressed.
Module Contents#
Classes#
API#
- class Beacon#
Bases:
page_tours.driver.DriverObjectThe marker that shows where a hint is, as Driver.js takes it.
The fields are named as Driver.js names them. An option left as
Noneis left out, so the value Driver.js falls back to applies. Set on a hint, it applies to that hint; set on the hints, it applies to every hint without one.- Parameters:
side – Which side of the element the beacon sits on.
align – How the beacon lines up along that side.
animate – Whether the beacon pulses.
className – A class added to the beacon.
offsetX – How far the beacon moves across, in pixels.
offsetY – How far the beacon moves down, in pixels.
- class Hint#
Bases:
page_tours.driver.PopoverContentOne hint on a page, as Driver.js takes it.
The fields are named as Driver.js names them. An option left as
Nonefalls back to the value of the same name on the hints. Title, description and the button text are passed to Driver.js as they are, and it writes them into the page as HTML. Give every hint a title: it names the hint’s beacon.- Parameters:
title – The heading of the popover.
description – The body of the popover.
element – A CSS selector for the element the hint points at.
id – What a browser remembers the hint was dismissed under. Without one, the hint’s position among the hints stands in for it.
beacon – The marker of this hint.
showButton – Whether the popover shows its button.
buttonText – The text of the popover’s button.
side – Which side of the element the popover sits on.
align – How the popover lines up along that side.
popoverClass – A class added to this hint’s popover.
- class Hints#
Bases:
page_tours.driver.DeclarationHints on one page.
A view puts the hints in its template context, and
{{ hints }}in the page’s template renders them. Every set of hints is recorded under its name when it is made, so the system checks can report a name declared twice or aPAGE_TOURS_OVERRIDESkey that names nothing.The fields after
versionare Driver.js’s hint options, named and defaulting to the value Driver.js itself uses. Options that take a JavaScript function are not available. Driver.js writes the button text into the page as HTML, so it is passed on as it is.- Parameters:
name – The name the hints are known by: a browser remembers which were dismissed under it, and
PAGE_TOURS_OVERRIDESchanges the hints by it. Plain text, never empty, and not shared with a tour.hints – The hints, in order. At least one.
version – A whole number of 1 or more. Raise it when the hints have changed enough that dismissed ones should show again.
beacon – The marker of every hint that has none of its own.
buttonText – The text of the popover’s button, in the active language by default.
popoverClass – A class added to every popover.
popoverOffset – The distance between the popover and the element, in pixels.
overlay – Whether the page is dimmed while a popover is open.
overlayColor – The colour of the overlay.
overlayOpacity – The opacity of the overlay, from 0 to 1.
- Raises:
ImproperlyConfigured – If
nameis not a string with something in it orversionis not a whole number of 1 or more.
- __post_init__()#
Freeze the hints and declare them under their name.