Created
August 11, 2010 18:59
-
-
Save laurynas/519530 to your computer and use it in GitHub Desktop.
Generate "Add to TomTom" button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TomTomHelper | |
# Generate Add To TomTom button | |
# You can pass following options hash: | |
# name - place name | |
# latitude - decimal latitude | |
# longitude - decimal longitude | |
# attribution - your attribution | |
# logo - link to your logo | |
# | |
# You can get API key here: | |
# https://www.tomtom.com/myTomTom/myProfile/apikey.php?generate=1 | |
# | |
# More information: | |
# http://www.tomtom.com/lib/doc/TomTomTips/index.html | |
def add_to_tomtom_button(options) | |
options = { | |
:action => 'add', | |
:apikey => 'YOUR TOM TOM APIKEY', | |
:name => nil, | |
:latitude => nil, | |
:longitude => nil, | |
:attribution => t('generic.page_title'), | |
:logo => nil | |
}.merge(options) | |
url = "http://addto.tomtom.com/api/home/v2/georeference?" | |
options.each { |k,v| url << [ k, CGI::escape(v.to_s) ].join('=') + '&' } | |
img = image_tag('http://addto.tomtom.com/api/images/addtotomtom-button.gif', :alt => 'Add to TomTom') | |
link_to img, url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment