Sha256: 5bef5cbbe18a6db5746d53b8febd2594ecf8bfb61fc4bbc9230b2296492309ca

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

Chaskiq.Helpers.showModal = (body, header, opts={}) ->
  window.Chaskiq.Helpers.cleanModal()
  body   ?= ""
  header ?= ""
  @myModal     = $("#myModal")
  @modalHeader = $("#myModal .modal-header")
  @modalBody   = $("#myModal .modal-body")
  @modalFooter = $("#myModal .modal-footer")
  @myModal.attr("data-modal-name",opts.modal_name) if opts.modal_name
  @myModal.find('.modal-dialog').addClass(opts.dialog_class) if opts.dialog_class

  if opts['noheader'] then @modalHeader.addClass('hidden') else @modalHeader.removeClass('hidden')
  if opts['nofooter'] then @modalFooter.addClass('hidden') else @modalFooter.removeClass('hidden')

  @modalBody.html body
  @myModal.modal("show")

  this.myModal[0].className = "modal fade in"
  @modalHeader.find('h4').html header unless header.length == 0
  return @myModal

Chaskiq.Helpers.cleanModal = () ->
  self = $("#modal")
  haveModalName = self.attr("data-modal-name")
  self.attr("data-modal-name","")  if typeof haveModalName isnt "undefined" and haveModalName isnt false # 1
  self.find(".modal-dialog").removeClass().addClass("modal-dialog")
  self.find(".modal-container, .modal-title").html('')

Chaskiq.Helpers.hideModal = ()->
  $('#myModal').modal('hide');

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chaskiq-0.0.3 app/assets/javascripts/chaskiq/manage/helpers.js.coffee
chaskiq-0.0.2 app/assets/javascripts/chaskiq/manage/helpers.js.coffee