Add forms for displaying and gathering consent.
Review Request #9925 — Created May 11, 2018 and submitted
This introduces a new
features fields, widgets, and form mixins for prompting for consent.
Along with the rest of the consent functionality, it's now very easy
for applications to offer users options on how to manage their own
ConsentRequirementField(and its corresponding widget) displays an
informative field for a single
ConsentRequirement. It clearly lists
a summary of the requirement, an optional icon representing it, a
description of the intended usage, and a description of what data would
be sent. Two buttons, "Allow" and "Block," are available to allow usage
of their private data for the feature or to block usage.
ConsentRequirementFields, one for each requirement provided (or one
for each one registered in the registry). This is intended for forms
that want to offer all (or many) options at once.
ConsentFormMixincan be mixed into other forms, and will construct a
MultiConsentRequirementsFieldon initialization. It provides a handful
of methods to override for controlling data going into the field, and a
save_consent()method to save and record the choices made.
ConsentConfigPageFormMixinis used for configforms, and provides
default implementations of the methods needed by
also automatically handles the saving, and adds a message to display
on the form when saved. This is the easiest way to provide consent
information to users.
Unit tests pass.
Manually and thoroughly tested this form, allowing and blocking
consent for multiple options and testing results. Tested validation
logic and resulting data in the database on success.
Using general comments because image comments are broken on this deploy:
For the error case, I feel like the error message is hard to see, and it's also probably hard to know immediately which things still need choices.
Can we move the error message next to the "Save" button, and then add some kind of callout for each un-chosen item (maybe bold red arrows next to the allow/block actions)?
list -> list of
I don't think "decorational" is a word
- Fixed some doc errors.
- Changed the styling a bit to promote unchosen consent. It now has a goldish background with a box shadow. Selected options no longer have have a box shadow, and the title matches the Allow/Block color.
Revision 2 (+1584)
Checks run (1 succeeded, 1 failed with error)