MattHall / maptastic

Formtastic extension for selecting locations on a Google Map

Home Page:http://codebeef.com/formtastic-map-location-selector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Formtastic Location Selector

Installation

First, you'll need to install Formtastic.

Next, install Maptastic as a plugin:

script/plugin install git@github.com:MattHall/maptastic.git

...and run the rake task to install the required js file into your javascripts directory. You will probably need to include this in your layouts, too.

	    rake maptastic_form:install

You can alternatively install the gem:

gem install maptastic-form

Note if you're using the gem, then you'll need to copy the JS asset from:

https://github.com/MattHall/maptastic/blob/master/assets/javascripts/maptastic.js

You'll need to add the Google Maps V3 script include in your page, above your semantic_form:

<script type='text/javascript' src='http://maps.google.com/maps/api/js?sensor=true'></script>

Note that you no longer need an API key with the latest Google Maps release.

Usage

Maptastic adds a new #multi_input method as well as the map control:

<% semantic_form_for @venue do |f| %>
  <%= f.multi_input :latitude, :longitude, :as => :map %>
<% end %>

Note that the map input expects two parameters - a latitude and longitude. The order is important.

Development

This plugin is under development. It's pretty simple, and patches are very welcome.

The Repo is available on GitHub

Report bugs here

A testbed app is available to check that the changes made actually work as expected.

Project Info

Copyright © 2010 Matthew Hall, released under the MIT license.

About

Formtastic extension for selecting locations on a Google Map

http://codebeef.com/formtastic-map-location-selector

License:MIT License


Languages

Language:Ruby 67.4%Language:JavaScript 32.6%