Sha256: 844a2d591505e69af3d693d899f7a8fb9fb11f88be8ac6597b42951692c7e7b8

Contents?: true

Size: 619 Bytes

Versions: 3

Compression:

Stored size: 619 Bytes

Contents

class @StatusToggler

  bindToggle : () ->
    $('[data-toggle-url]').click (e) =>
      @_toggleStatus $(e.currentTarget)

  _toggleStatus : ($button) ->
    unless @sending
      @sending = true
      $.ajax
        type : 'post'
        url : $button.data('toggleUrl')
        dataType : 'json'
        success : (data) =>
          notifier.notify data.message
      .always () =>
        @sending = false

  @init : () ->
    statusToggler = new this
    statusToggler.bindToggle()
    statusToggler

  @initPlugin : () =>
    @init()

$ ->
  $(document).on 'ready page:load init-plugins', StatusToggler.initPlugin

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rademade_admin-0.2.2 app/assets/javascripts/rademade_admin/app/common/status-toggler.coffee
rademade_admin-0.2.1 app/assets/javascripts/rademade_admin/app/common/status-toggler.coffee
rademade_admin-0.2.0 app/assets/javascripts/rademade_admin/app/common/status-toggler.coffee