Sha256: a61f0d0389ad8c8d4f1b327774a2623d30df5650a445f5fcb084e21fe4b010da

Contents?: true

Size: 1.89 KB

Versions: 5

Compression:

Stored size: 1.89 KB

Contents

# Global functions referenced from HTML
@showWaiting = (element_id, text, centered) ->
  element = $(element_id)
  if element && centered
    element.html("<div class='spinner-centered'><div class='spinner'>#{text}</div></div>")
  else if element
    element.html("<div class='spinner'>#{text}</div>")

@flashMessage = (message, alert_type = 'success', overwrite = true) ->
  div_block = "<div class='navbar-alert alert alert-#{alert_type}'><button type='button' class='close' data-dismiss='alert'>×</button>#{message}</div>"
  flash_container = $('[data-object~="flash-container"]')
  if overwrite
    flash_container.html(div_block)
  else
    flash_container.append(div_block)

@nonStandardClick = (event) ->
  event.which > 1 or event.metaKey or event.ctrlKey or event.shiftKey or event.altKey

$(document)
  .on('change', '.datepicker', () ->
    try
      $(this).val($.datepicker.formatDate('mm/dd/yy', $.datepicker.parseDate('mm/dd/yy', $(this).val())))
    catch error
      # Nothing
  )
  .on('click', ".pagination a, .page a, .next a, .prev a", () ->
    return false if $(this).parent().is('.active, .disabled, .per_page')
    $.get(this.href, null, null, "script")
    false
  )
  .on("click", ".per_page a", () ->
    object_class = $(this).data('object')
    $.get($("#"+object_class+"_search").attr("action"), $("#"+object_class+"_search").serialize() + "&"+object_class+"_per_page="+ $(this).data('count'), null, "script")
    false
  )
  .on('click', '[data-object~="order"]', () ->
    $('#order').val($(this).data('order'))
    $($(this).data('form')).submit()
    false
  )

@ready = () ->
  $(".timepicker").timepicker
    showMeridian: false
    showSeconds: true
    defaultTime: false
  $(".datepicker").datepicker('remove')
  $(".datepicker").datepicker( autoclose: true )

  # Load forms on page load
  $('[data-object~="form-load"]').submit()

$(document).ready(ready)
# $(document).on('page:load', ready)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
contour-2.1.0.beta2 app/assets/javascripts/contour/global.js.coffee
contour-2.1.0.beta1 app/assets/javascripts/contour/global.js.coffee
contour-2.0.0 app/assets/javascripts/contour/global.js.coffee
contour-2.0.0.rc6 app/assets/javascripts/contour/global.js.coffee
contour-2.0.0.rc5 app/assets/javascripts/contour/global.js.coffee