Sha256: e6326f978f15d215381837629ee876ca397291007c3ca991277d1c89e76e3ce2

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

class Lanes.Component.ModalDialog extends Lanes.Component.Base

    events:
        'hide.bs.modal': '_onHide'

    bindings:
        'ui.layout_size': { type:'class',selector:'.modal-dialog'}

    buttons:
        close: { label: 'Close', type: 'default', dismiss: true }

    session:
        dialog_title: 'string'

    initialize: (options)->
        super

    toggleShown: (show)->
        if show then this.show() else this.hide()

    template: (context)->
        tmpl = Lanes.Templates.find('modal', context.namespace)
        tmpl({
            size    : context.size  || 'lg'
            title   : context.title || context.dialog_title
            body    : context.renderTemplateMethod('bodyTemplate')
            buttons : context.buttons
        })

    hide:->
        this.$el.modal('hide')
        Lanes.Promise.resolve( this )

    show: ->
        this.render()
        this.$el.modal({ body: this.ui.viewport })
        this.notification = new Lanes.Deferred
        return this.notification.promise

    destroy: ->
        this.detach()

    _onHide: (ev)->
        this.notification.resolve(this)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lanes-0.0.3 client/javascripts/component/ModalDialog.coffee
lanes-0.0.2 client/javascripts/component/ModalDialog.coffee
lanes-0.0.1 client/javascripts/component/ModalDialog.coffee