Better support radio inputs in bindProperty and config forms actions.
Review Request #6160 — Created July 28, 2014 and submitted
$.fn.bindProperty()
now accepts aradioValue
option. If set, this
will manage standard radio behavior between radio input elements and
a model property. Each input is expected to havebindProperty()
called
on it, passing aradioValue
corresponding to the appropriate value in
the model's property.When the element's property (which is expected to be a boolean) changes
to true, the model's property will be set to theradioValue
. Otherwise,
to prevent conflicts, nothing will be set on the model (with the
expectation being that anotherbindProperty()
will handle the radio
input that's now checked).When the model's property changes, the value will be compared against
theradioValue
. If they match, the radio input will be checked.The new radio action support for config form list items now support
taking aradioValue
, which is then passed tobindProperty
.
Made use of this in a change to associate multiple radio inputs with a
single model property. Verified that the element and model always had
matching states.Added new unit tests, which pass.
Description | From | Last Updated |
---|---|---|
The !isCheckbox is meaningless because obviously action.type won't be 'checkbox' if it's 'radio'. |
david |
- Description:
-
~ $.fn.bindProperty()
now accepts aradioValue
option that. If set, this~ $.fn.bindProperty()
now accepts aradioValue
option. If set, thiswill manage standard radio behavior between radio input elements and a model property. Each input is expected to have bindProperty()
calledon it, passing a radioValue
corresponding to the appropriate value inthe model's property. When the element's property (which is expected to be a boolean) changes
to true, the model's property will be set to the radioValue
. Otherwise,to prevent conflicts, nothing will be set on the model (with the expectation being that another bindProperty()
will handle the radioinput that's now checked). When the model's property changes, the value will be compared against
the radioValue
. If they match, the radio input will be checked.The new radio action support for config form list items now support
taking a radioValue
, which is then passed tobindProperty
.
- Change Summary:
-
Removed an optimization.
- Commit:
-
9546548f605cb00b51a113e113e027c3ca7b92e934a199ce868f6794c01adc79c8c9d525b5039a19
-
Tool: Pyflakes Ignored Files: djblets/static/djblets/js/tests/backboneUtilsTests.js djblets/static/djblets/js/jquery.gravy.backboneUtils.js djblets/static/djblets/js/configForms/views/listItemView.js Tool: PEP8 Style Checker Ignored Files: djblets/static/djblets/js/tests/backboneUtilsTests.js djblets/static/djblets/js/jquery.gravy.backboneUtils.js djblets/static/djblets/js/configForms/views/listItemView.js