Sha256: 36d412fef996a2661abde16392483be54531b20b64bf4bb8f54bf6b51041dc25

Contents?: true

Size: 442 Bytes

Versions: 3

Compression:

Stored size: 442 Bytes

Contents

(($) ->
  $ ->
    $('.subscribe a').bind 'ajax:success', (event, XMLHttpRequest, ajaxOptions) -> 
      element   = $(event.target)
      method    = element.data('method')
      txt       = element.data('switch-text')
      switchTxt = element.text()
      newMethod = if method == 'post' then 'delete' else 'post'
      
      element.data('method', newMethod)
      element.data('switch-text', switchTxt)
      element.text(txt)
)(jQuery)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
formol-0.0.6 app/assets/javascripts/formol/subscriptions.js.coffee
formol-0.0.5 app/assets/javascripts/formol/subscriptions.js.coffee
formol-0.0.4 app/assets/javascripts/formol/subscriptions.js.coffee