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.8.1 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.8.0 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.7.4 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.7.3 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.7.2 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.7.1 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.7.0 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.31 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.30 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.29 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.28 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.27 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.26 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.25 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.24 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.23 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.22 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.21 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.20 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.6.19 app/assets/javascripts/effective_bootstrap/base.js.coffee