Sha256: a5a616898c42ff512c99ce7ef1ff1bf1c8f4f7e024f321f40cfbf29859e1dfa1

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

Luca.concerns.ModalView = 
  version: 3

  closeOnEscape: true

  showOnInitialize: false

  backdrop: false

  __initializer: ()->
    return unless @modal is true

    @on "before:render", @applyModalConfig, @
    
    @

  applyModalConfig: ()->
    @$el.addClass 'modal'
    @$el.addClass 'fade' if @fade is true

    @$el.modal
      backdrop: @backdrop is true
      keyboard: @closeOnEscape is true
      show: @showOnInitialize is true

    @$el.css('display','none') unless @showOnInitialize is true
    @      
 
  container: ()->
    $('body')

  toggle: ()->
    @$el.modal('toggle')

  show: ()->
    @render() unless @rendered is true
    @trigger "before:show"
    @$el.modal('show')
    @trigger "after:show"

  hide: ()->
    @trigger "before:hide"
    @$el.modal('hide')
    @trigger "after:hide"

  setModalDimensions: (height, width)->
    if _.isObject(height)
      {height,width} = height

    @setModalHeight( height ) if height?
    @setModalWidth( width ) if width?

  setModalWidth: (width)->
    @$el.css
      "width": width
      "max-width": width
      "margin-left": width * 0.5 * -1

  setModalHeight: (height)->
    @$el.css
      "max-height": height
      "margin-top": height * 0.5 * -1
      "height": height 

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
luca-0.9.91 app/assets/javascripts/luca/concerns/modal_view.coffee
luca-0.9.9 app/assets/javascripts/luca/concerns/modal_view.coffee
luca-0.9.899 app/assets/javascripts/luca/concerns/modal_view.coffee
luca-0.9.89 app/assets/javascripts/luca/concerns/modal_view.coffee