Sha256: 661be32b6dc64afbe0f62aa79e6441b6ecb9dbf9a91ed81bdc7883b51bbb7693

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

window.CMI or= {}

#
# Will triggers method "onCumaCheckboxClick: (targetLabel)" on
# the view if method is defined.
#
class CMI.FormCheckboxBehavior extends Marionette.Behavior

  ui:
    checkboxLabels: '.cmi-checkbox-container label'

  events:
    'click @ui.checkboxLabels': 'onLabelClick'

  onRender: ->
    @ui.checkboxLabels.each ->
      CMI.FormComponents.Checkbox.reset($(this))

  onLabelClick: (event) ->
    event.preventDefault()
    target = $(event.currentTarget)
    CMI.FormComponents.Checkbox.click(target)

    @view.triggerMethod('cmi:checkbox:click', target)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
curo-material-interface-0.0.6 lib/assets/javascripts/cmi/behaviors/form_checkbox_behavior.coffee
curo-material-interface-0.0.5 lib/assets/javascripts/cmi/behaviors/form_checkbox_behavior.coffee
curo-material-interface-0.0.4 lib/assets/javascripts/cmi/behaviors/form_checkbox_behavior.coffee
curo-material-interface-0.0.3 lib/assets/javascripts/cmi/behaviors/form_checkbox_behavior.coffee