Add a form field for configuring conditions.

Review Request #8279 — Created July 11, 2016 and submitted — Latest diff uploaded

Information

Djblets
release-0.10.x
67b270a...

Reviewers

This introduces a new Django form field that allows users to view and
configure conditions. This is presented as a JavaScript-backed widget
that shows each condition as a row containing drop-downs for the choice
and operator, and a field for the value. Below these are a button for
adding new condition rows.

Changing a choice will change the list of operators available, and
reset the value for the new type of field. Changing just the operator
will retain the value unless the new or old operators had a custom value
field.

Conditions can be deleted by clicking a "-" button on the left of the
row.

The widget is designed to handle form validation and to be resilient to
missing choices/operators (which could happen if working with conditions
that were based on choices/operators from extensions). Errors specific
to a condition (value validation issues, for instance) will show up in
the row for that condition, and will be resolved once corrected and the
form re-submitted. Missing condition choices/operators will result in a
disabled condition row, which must be deleted before the form can be
submitted again.

Tested loading/editing existing conditions, adding new ones, and deleting
them.

Tested custom value fields on both choices and operators.

Tested choices/operators that don't need a value.

Tested that the value was preserved when switching operators within a choice,
unless the old/new operator had a custom value field.

Tested validation errors for value fields.

Tested usage of extension-provided custom choices/operators.

Tested missing choice/operators, their presentation, and inability to save
until the conditions were removed.

Unit tests pass.


    Loading...