Sha256: 5128bf3bb98080c7fbc21763e64e48f711a2ddd4907907565be3f6043045f2ab

Contents?: true

Size: 618 Bytes

Versions: 53

Compression:

Stored size: 618 Bytes

Contents

class Turbolinks.Form
  constructor: (@$form) ->
    @$form.on('submit', (e) => @submit(e))

  submit: (e) ->
    e.preventDefault()
    @visit(@buildUrl())

  buildUrl: ->
    url  = @$form.attr('action')
    url += if url.indexOf('?') is -1 then '?' else '&'
    url +  @$form.serialize()

  visit: (url) ->
    Turbolinks.visit(url);


$(document).on "submit", "form[method='get']:not([data-no-turboform])", (e) ->
  $form = $(e.currentTarget)
  unless (turboform = $form.data('turboform-instance'))
    turboform = new Turbolinks.Form($form)
    $form.data('turboform-instance', turboform)
    turboform.submit(e)

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
para-0.11.4 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.11.3 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.11.2 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.11.1 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.11.0 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.10.0 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.9.4 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.9.3.3 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.9.3.2 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.9.3.1 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.9.2 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.9.0 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.15 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.14 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.13 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.12 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.11 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.10 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.9 app/assets/javascripts/para/lib/turbolinks-forms.coffee
para-0.8.8 app/assets/javascripts/para/lib/turbolinks-forms.coffee