Sha256: 0df6a468ada73084fe52fe8aedd176a9622282ca66dd8a0fcf554a71363c3958

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

class Lanes.Components.ModalDialog extends Lanes.Components.Base

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

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

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

    session:
        dialog_title: 'string'

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

    template: ->
        tmpl = Lanes.Templates.find('lanes/components/modal/template')
        tmpl({
            size    : @size  || 'lg'
            title   : @title || context.dialog_title
            body    : this.renderTemplateMethod('bodyTemplate')
            buttons : @buttons
        })

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

    show: ->
        if this.rendered
            this.viewport.el.append(this.el)
            this.$el.modal('show')
        else
            this.render()
            this.$el.modal({ body: this.viewport.el })
        this.notification = new _.DeferredPromise
        return this.notification.promise

    destroy: ->
        this.detach()

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lanes-0.1.2 client/lanes/components/modal/ModalDialog.coffee