kristianmandrup / gmaps-autocomplete-rails

Google Maps v3 search with jQuery UI Autocomplete, ready for use with Rails asset pipeline
MIT License
73 stars 35 forks source link

Can be this gem used without specification of country? #20

Open Jirka1111 opened 8 years ago

Jirka1111 commented 8 years ago

Can be this gem used without specification of country? #

kristianmandrup commented 8 years ago

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

jkras commented 8 years ago

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

kristianmandrup commented 8 years ago

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...