Support invoking radio action handlers on click in config form actions.

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

Information

Djblets
release-0.8.x
d3ba23e...

Reviewers

Unlike a checkbox, a second click on a radio input won't trigger a
'change' event, since you can't uncheck a radio input without clicking
on a different radio input. This made it impossible to respond to click
events (which I have a need for in another change -- a "Custom" radio
input entry that invokes a dialog).

To get notified on a click event, actions can set
dispatchOnClick: true on the action. Clicking the radio or its label
will then result in the action handler being called, even if the radio
is already checked.

Since the browser will fire both a change and a click event, and there's
nothing we can do about that, we need to use debounce() to ensure the
handler is only called once.

In another change, I added an action with dispatchOnClick: true.

The radio button, when already checked, would trigger my action handler
on click, just once.

When not checked, clicking it would also trigger my action handler, just once.
No repeated events.

reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        djblets/static/djblets/js/configForms/views/listItemView.js
    
    
    
    Tool: Pyflakes
    Ignored Files:
        djblets/static/djblets/js/configForms/views/listItemView.js
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.8.x (e770eda)
Loading...