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.11.7 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.6 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.5 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.4 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.3 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.2 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.1 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.11.0 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.17 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.16 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.15 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.14 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.13 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.12 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.11 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.10 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.9 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.8 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.7 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.10.6 app/assets/javascripts/effective_bootstrap/base.js.coffee