Sha256: 578f9d2494636ecdd12e90b12bcdfa6f03af9db25b1206490ceedf5de1135d11

Contents?: true

Size: 847 Bytes

Versions: 6

Compression:

Stored size: 847 Bytes

Contents

require 'action_view/helpers/capture_helper'
require 'action_view/helpers/sanitize_helper'
require 'action_view/helpers/url_helper'
require 'action_view/helpers/text_helper'
require "action_view/helpers/tag_helper"
require "action_view/helpers/form_tag_helper"

class ActionView::Helpers::FormBuilder
  include ActionView::Helpers::FormTagHelper
  include ActionView::Helpers::TagHelper
  
  def autocomplete_field name, path
    hash = Digest::MD5.hexdigest(name.to_s)
    output = text_field_tag("#{name}_autocomplete", nil, {  "class" => "rails-autocomplete", "data-autocomplete-parent" => hash, "data-autocomplete-url" => path, "data-provide" => "typeahead", "data-source" => "rails_autocomplete", "autocomplete" => "off" }).html_safe
    output << self.hidden_field(name, { "data-autocomplete-child" => hash }).html_safe
    output
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_autocomplete-0.1.0 lib/rails_autocomplete/form_helper.rb
rails_autocomplete-0.0.6 lib/rails_autocomplete/form_helper.rb
rails_autocomplete-0.0.5 lib/rails_autocomplete/form_helper.rb
rails_autocomplete-0.0.4 lib/rails_autocomplete/form_helper.rb
rails_autocomplete-0.0.3 lib/rails_autocomplete/form_helper.rb
rails_autocomplete-0.0.2 lib/rails_autocomplete/form_helper.rb