• 
      

    Better support radio inputs in bindProperty and config forms actions.

    Review Request #6160 — Created July 28, 2014 and submitted

    Information

    Djblets
    release-0.8.x
    34a199c...

    Reviewers

    $.fn.bindProperty() now accepts a radioValue option. If set, this
    will manage standard radio behavior between radio input elements and
    a model property. Each input is expected to have bindProperty() called
    on it, passing a radioValue 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 the radioValue. Otherwise,
    to prevent conflicts, nothing will be set on the model (with the
    expectation being that another bindProperty() will handle the radio
    input 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 to bindProperty.

    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'.

    daviddavid
    reviewbot
    1. 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
      
      
      
      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
      
      
    2. 
        
    david
    1. The first line of your change description is.

    2. Show all issues

      The !isCheckbox is meaningless because obviously action.type won't be 'checkbox' if it's 'radio'.

      1. It was intended as an optimization to avoid a second string comparison.

      2. This doesn't seem to be code that gets called very often.

    3. 
        
    chipx86
    chipx86
    reviewbot
    1. 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
      
      
    2. 
        
    david
    1. Ship It!

    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-0.8.x (f8e710a)