Sha256: e6f07fc311fd46fa43ef8de7adad3fb2561174a9ea03424fee1c2edc340a0b80

Contents?: true

Size: 1.02 KB

Versions: 25

Compression:

Stored size: 1.02 KB

Contents

define ->

  'use strict'

  type: 'Base'

  version: '0.1.2'

  initialize: (options) ->
    names = []
    {identifier} = options

    # TODO access omit method throuhgh underscore
    widget_options =  _.omit options, 'el', 'ref', '_ref', 'name', 'require', 'baseUrl', 'resource'

    # TODO remove jquery dependency
    for name, suboptions of widget_options when $.type(suboptions) is "object"
      names.push suboptions.name || name
      @add suboptions.name || name, suboptions

    @$el.addClass ['tray', 'widget'].concat(names).join(' ')

    @identifier ||= identifier

    # TODO find a way to build the id based on content
    if identifier?
      @identifier = identifier
      @$el.attr 'id', identifier

    @sandbox.start()

  add: (name, options) ->

    # TODO add widgets as childrens of the tray widget sandbox
    # TODO remove jquery dependency, and use documentFragment to build widgets
    element     = jQuery '<div class="widget"></div>'
    options.el  = element
    @$el.append   element
    @inject name, options

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
ende-0.4.25 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.24 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.23 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.22 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.21 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.16 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.3.13 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.3.12 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.3.11 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.15 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.14 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.13 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.12 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.11 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.10 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.9 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.8 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.7 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.6 lib/assets/javascripts/widgets/tray/main.js.coffee
ende-0.4.5 lib/assets/javascripts/widgets/tray/main.js.coffee