Sha256: 8d9b894b2f7a385057912811a04e7ef6554f39c0ba8ef6bc78038c72e4e55087
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
Joosy.Modules.Container = events: false elements: false eventSplitter: /^(\S+)\s*(.*)$/ $: (selector) -> $(selector, @container) refreshElements: -> @__collectElements().each (key, value) => # TODO: Check for possible collisions? @[key] = @$(value) swapContainer: (container, data) -> container.unbind().off() container.html data container __collectElements: -> elements = Object.extended @elements || {} klass = this while klass = klass.constructor.__super__ Joosy.Module.merge elements, klass.elements, false elements __collectEvents: -> events = Object.extended @events || {} klass = this while klass = klass.constructor.__super__ Joosy.Module.merge events, klass.events, false events __extractSelector: (selector) -> if r = selector.match /\$([A-z]+)/ selector = @__collectElements()[r[1]] selector __delegateEvents: -> module = this events = @__collectEvents() events.each (key, method) => unless Object.isFunction method method = @[method] callback = (event) -> method.call module, this, event match = key.match @eventSplitter eventName = match[1] selector = @__extractSelector match[2] if selector == "" @container.bind eventName, callback Joosy.Modules.Log.debugAs @, "#{eventName} binded on container" else @container.on eventName, selector, callback Joosy.Modules.Log.debugAs @, "#{eventName} binded on #{selector}"
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
joosy-0.1.0.RC2 | app/assets/javascripts/joosy/core/modules/container.js.coffee |