Skip to content

GeoYahoo is a simple Rails plugin that integrates Yahoo Geo api with your Rails Application, using jQuery autocomplete.

License

Notifications You must be signed in to change notification settings

albertopq/geo_yahoo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoYahoo
========

GeoYahoo is a simple Rails plugin that integrates Yahoo Geo api (http://developer.yahoo.com/geo/geoplanet/) with your Rails Application, using jQuery autocomplete.
You can easily add an autocomplete Hometown field to your models, forgiving annoying Country and City tables in your app.

Installation
=======
Go to your application dir and type

script/plugin install http://github.com/wadomo/GeoYahoo.git

Add this line before the last "end" of your config/environment.rb file:

ENV['YAHOO_API'] = "yourapikeyhere" (get it here http://developer.yahoo.com/geo/geoplanet/)

IMPORTANT!

You must include in your layout ( if you don't have yet):

<%= javascript_include_tag :defaults %>

That's it! Now you can add an autocomplete city field in your views!

Example
=======

Add this to your view.
<p>
        <%= text_field_tag :city_autocomplete,"" %>
        <%= hidden_field_tag :country  %>
        <%= hidden_field_tag :state %>
        <%= hidden_field_tag :city %>
        <%= geo_autocomplete "city_autocomplete",[:city,:country,:state] %>
</p>



It will update the hidden fields with the results of yahoo api request.
You can customize the way that the results are shown adding a geo_yahoo/cities.html.erb file in your app/views folder.


=============================================================================
Copyright (c) 2010 WaDoMo, released under the MIT license

About

GeoYahoo is a simple Rails plugin that integrates Yahoo Geo api with your Rails Application, using jQuery autocomplete.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published