Sha256: f94889f1ef8fb4e175be9545a0c4e7a6794e6bf06594f8881089fdac0efed6d9

Contents?: true

Size: 650 Bytes

Versions: 10

Compression:

Stored size: 650 Bytes

Contents

class @FormPopup.Initializer extends Backbone.View

  _popupViews : []

  showPopup : (model) ->
    popupView = FormPopup.View.init model
    @addPopup popupView
    @$el.append popupView.$el

  addPopup : (popup) ->
    popup.on 'close', @_onPopupClose
    @_last().hide() if @_hasPopups()
    @_popupViews.push popup

  _onPopupClose : () =>
    @_popupViews.pop()
    @_last().show() if @_hasPopups()

  _last : () ->
    _.last @_popupViews

  _hasPopups : () ->
    @_popupViews.length > 0


  @getInstance : () ->
    instance = null
    do () ->
      instance ||= new @FormPopup.Initializer
        el : document.getElementById 'pad-wrapper'

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rademade_admin-0.2.2 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.2.1 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.2.0 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.6 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.5 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.4 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.3 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.2 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.1 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee
rademade_admin-0.1.0 app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee