Sha256: 4e15a226d210c969efdc47e637b4f039f3a1fbbe7d724f153ed3bbff98b71ac5

Contents?: true

Size: 953 Bytes

Versions: 13

Compression:

Stored size: 953 Bytes

Contents

module Turbolinks::Form
  module ViewHelper
    extend ActiveSupport::Concern

    def form_for(record_or_name_or_array, *args, &proc)
      options = args.extract_options!

      # makes submit a xhr request that accepts html as response
      if options.keys.include?(:turbolinks_form) && options[:turbolinks_form]
        options[:remote] = true
        options[:data] ||= {}
        options[:data][:turbolinks_form] = true
      end

      super(record_or_name_or_array, *(args << options), &proc)
    end

    def form_tag(record_or_name_or_array, *args, &proc)
      options = args.extract_options!

      # makes submit a xhr request that accepts html as response
      if options.keys.include?(:turbolinks_form) && options[:turbolinks_form]
        options[:remote] = true
        options[:data] ||= {}
        options[:data][:turbolinks_form] = true
      end

      super(record_or_name_or_array, *(args << options), &proc)
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
turbolinks-form-0.1.5 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.1.4 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.1.3 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.1.2 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.1.1 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.8 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.7 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.6 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.5 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.4 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.3 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.2 lib/turbolinks/form/view_helper.rb
turbolinks-form-0.0.1 lib/turbolinks/form/view_helper.rb