kristianmandrup/gmaps-autocomplete-rails

Can be this gem used without specification of country?

Opened this issue · 3 comments

Can be this gem used without specification of country? #

You can try ;) Read the gmaps API, tweak the gem as you like and make a PR

jkras commented

To clarify, this is a workaround to achieve the desired functionality from @Jirka1111's question. This removes the ability to specify a region, and restrict results so would probably not be suitable for a PR.

If you reverse this commit you can achieve typeahead for any country.

To test locally, I unpacked the gem using

gem unpack gmaps-autocomplete-rails

Then modified gmaps-autocomplete-rails-0.2.0/vendor/assets/javascripts/gmaps-auto-complete.coffee per the commit above

Then changed the entry in my gemfile to point to the local gem (just to test)

gem 'gmaps-autocomplete-rails', :path => '~/workspace/gmaps-autocomplete-rails-0.2.0'

Then

bundle install

Finally, remove the region line from the autoCompleteInit method

You are welcome to make a PR that properly allows for both modes ;)
You are also very welcome to clean up the javascript, use ES classes and split functionality up instead of having it all in one big master class...