Sha256: d423d7a3220d17215c9b4beb2456b15b85ba60517cafe5ea1d069fcb32807eb1

Contents?: true

Size: 923 Bytes

Versions: 6

Compression:

Stored size: 923 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')

      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

6 entries across 6 versions & 1 rubygems

Version Path
effective_bootstrap-0.5.3 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.5.2 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.5.1 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.5.0 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.4.8 app/assets/javascripts/effective_bootstrap/base.js.coffee
effective_bootstrap-0.4.7 app/assets/javascripts/effective_bootstrap/base.js.coffee