Sha256: ae406743a609f2f4357d076f628a11694d3831ac0db6fdbd7a63459539111b47

Contents?: true

Size: 991 Bytes

Versions: 136

Compression:

Stored size: 991 Bytes

Contents

# This initializes all the effective_* form inputs also in this gem
this.EffectiveBootstrap ||= new class
  initialize: (target) ->
    $(target || document).find('[data-input-js-options]:not(.initialized)').each (i, element) ->
      $element = $(element)
      options = $element.data('input-js-options')

      return true unless (options['method_name'] || '').length > 0

      method_name = options['method_name']
      delete options['method_name']

      unless EffectiveBootstrap[method_name]
        return console.error("EffectiveBootstrap #{method_name} has not been implemented")

      EffectiveBootstrap[method_name].call(this, $element, options)
      $element.addClass('initialized')

$ -> EffectiveBootstrap.initialize()
$(document).on 'turbolinks:load', -> EffectiveBootstrap.initialize()
$(document).on 'cocoon:after-insert', -> EffectiveBootstrap.initialize()
$(document).on 'effective-bootstrap:initialize', (event) -> EffectiveBootstrap.initialize(event.currentTarget)

Version data entries

136 entries across 136 versions & 1 rubygems

Version Path
effective_bootstrap-0.10.5 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.4 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.3 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.2 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.1 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.0 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.49 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.48 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.47 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.46 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.45 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.44 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.43 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.42 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.41 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.40 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.39 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.38 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.37 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.9.36 app/assets/javascripts/effective_bootstrap/base.js.coffee