Sha256: 45790bc6d1369d717e497da3e4f76d2dbd52897cad832abf700799cebfa14f8c

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

module SimpleForm

  module Inputs
    class AutocompleteInput < Base
      def input
        @builder.autocomplete_field(
          attribute_name,
          options[:url],
          html_options
        )
      end

    protected

      def limit
        column && column.limit
      end

      def has_placeholder?
        placeholder_present?
      end

      def html_options
        input_html_options.merge update_elements options[:update_elements]
      end

      def update_elements(elements)
        if elements
          {'data-update-elements' => elements.to_json}
        else
          {}
        end
      end
    end
  end

  class FormBuilder
    map_type :autocomplete, :to => SimpleForm::Inputs::AutocompleteInput
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails3-jquery-autocomplete-1.0.7 lib/rails3-jquery-autocomplete/simple_form_plugin.rb