Sha256: 45e0bb97279b155dbd7b1bd603aa90f6f20747bb18e92d3dbc976ba83031bd56

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

(this.EffectiveBootstrap || {}).effective_hide_if = ($element, options) ->

  $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")

  $affects.on 'change', (event) ->
    if $(event.target).val() == options.value
      $element.hide()
      element.find('input,textarea,select').prop('disabled', true)
    else
      $element.fadeIn()
      $element.find('input,textarea,select').removeAttr('disabled')

  # Maybe disable it now
  if options.needDisable
    $element.find('input,textarea,select').prop('disabled', true)


(this.EffectiveBootstrap || {}).effective_show_if = ($element, options) ->

  $affects = $element.closest('form').find("input[name='#{options.name}'],select[name='#{options.name}']")

  $affects.on 'change', (event) ->
    if $(event.target).val() == options.value
      $element.fadeIn()
      $element.find('input,textarea,select').removeAttr('disabled')
    else
      $element.hide()
      $element.find('input,textarea,select').prop('disabled', true)

  # Maybe disable it now
  if options.needDisable
    $element.find('input,textarea,select').prop('disabled', true)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
effective_bootstrap-0.6.17 app/assets/javascripts/effective_bootstrap/logic.js.coffee
effective_bootstrap-0.6.16 app/assets/javascripts/effective_bootstrap/logic.js.coffee
effective_bootstrap-0.6.15 app/assets/javascripts/effective_bootstrap/logic.js.coffee