Sha256: bf01c5aa888b29d7f22e59e2bf095ccd2e2908e0dafc93edf97b31ee5ee726f1

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

class @Manager
  @getInstanceName: (className) ->
    className.charAt(0).toLowerCase() + className.slice(1)

  @init = (container) ->
    classNames = container.data('component').split(' ')

    for className in classNames
      try
        instance = new (eval(className))(container)
        instanceName = Manager.getInstanceName(className)
        container.data(instanceName, instance)
      catch error
        try
          console.warn "#{className} component not found"

$(document).ready ->
  $('[data-component]').each (i, el) -> Manager.init($(el))

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
uploadbox-0.0.15 app/assets/javascripts/_manager.coffee
uploadbox-0.0.14 app/assets/javascripts/_manager.coffee