Sha256: 5bc17cbfadc082ef9e3e152d812a38d3237f7037360bb175c36c98088b42a27d

Contents?: true

Size: 712 Bytes

Versions: 4

Compression:

Stored size: 712 Bytes

Contents

class Para.TurbolinksLoading
  start: =>
    @addLoadingMarkup()

  stop: =>
    @removeLoadingMarkup()

  addLoadingMarkup: ->
    $('<div/>', class: 'loading-overlay', 'data-loading-overlay': true)
      .prependTo('body')
    $('<div/>', class: 'loading-spinner', 'data-loading-spinner': true)
      .prependTo('body')

  removeLoadingMarkup: ->
    $('[data-loading-overlay]').remove()
    $('[data-loading-spinner]').remove()

# Global loading manager allowing to
Para.loadingManager = new Para.TurbolinksLoading()

$(document).on('page:fetch', Para.loadingManager.start)

$(document).on 'page:change', ->
  Para.loadingManager.stop()
  $('body').on('submit', '[data-para-form]', Para.loadingManager.start)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
para-0.5.4 app/assets/javascripts/para/lib/turbolinks-loading.coffee
para-0.5.3 app/assets/javascripts/para/lib/turbolinks-loading.coffee
para-0.5.1 app/assets/javascripts/para/lib/turbolinks-loading.coffee
para-0.5.0 app/assets/javascripts/para/lib/turbolinks-loading.coffee