class Decidim::Map::Autocomplete::Builder

A builder for the geocoding autocompletion to be attached to the views. Provides all the necessary functionality to initialize the front-end geocoding autocompletion functionality.

Public Instance Methods

geocoding_field(object_name, method, options = {}) click to toggle source

Displays the geocoding field element's markup for the view.

@param object_name [String, Symbol] The name for the object for which

the field is generated for.

@param method [String, Symbol] The method/property in the object that

the field is for.

@param options [Hash] Extra options for the field. @return [String] The field element's markup.

# File lib/decidim/map/autocomplete.rb, line 20
def geocoding_field(object_name, method, options = {})
  options[:autocomplete] ||= "off"

  template.text_field(
    object_name,
    method,
    options.merge("data-decidim-geocoding" => view_options.to_json)
  )
end