Sha256: e45578fbccad4d954613dc4b0cc46af175e74feea8f5c4ffa475be6c3d48a5b9

Contents?: true

Size: 801 Bytes

Versions: 4

Compression:

Stored size: 801 Bytes

Contents

#= require partystreusel/namespace
#= require partystreusel/ie_fixes
class Partystreusel.Base
  # you must override this class variable
  # constructor.name does not work in minified js
  @className = 'Base'

  @selector: ->
    prefix = Partystreusel.selectorPrefix || 'streusel'
    if Streusel.selectorType == 'css_class'
      ".#{prefix}-#{@className.toLowerCase()}"
    else
      "[data-#{prefix}-#{@className.toLowerCase()}]"

  @init: (element = $('body')) ->
    element.find(@selector()).addBack(@selector())
      .filter (i, el) -> !($(el).data('object')?)
      .map (i, el) => new @(el)

  constructor: (el) ->
    @$el = $(el)
    @$el.data('object', @)

  trigger: (name) ->
    arguments[0] = "#{@constructor.className.toLowerCase()}-#{name}"
    @$el.trigger.apply(@$el, arguments)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
partystreusel-2.0.0 app/assets/javascripts/partystreusel/base.js.coffee
partystreusel-1.2.0 app/assets/javascripts/partystreusel/base.js.coffee
partystreusel-1.1.1 app/assets/javascripts/partystreusel/base.js.coffee
partystreusel-1.1.0 app/assets/javascripts/partystreusel/base.js.coffee