An extension to make integrating google maps into radiant 0.7 easier
Ruby JavaScript
Pull request Compare This branch is 10 commits ahead, 1 commit behind rurounijones:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app
db/migrate
lib/tasks
public
spec
LICENSE
README
Rakefile
gmaps_api_key.yml.sample
google_maps_extension.rb

README

Google Maps Extension

### Introduction

This extension allows users to create google maps and the other objects which make up an modern interactive google map.
It ONLY works with MySQL and PostgreSQL databases (and will for the forseeable future, depends on the spatial adapter).

This extension has been tested against Radiant 7.0 with MySQL and PostgreSQL.

### Requirements

You need to install a version >= 0.1.1 of the GeoRuby gem ( http://rubyforge.org/projects/georuby/ )
	gem install GeoRuby

Currently the rake tasks assume you are using the standard vendor/extensions directory path, if no you will need to copy the assets manually
(Including the Javascript files from the ym4r_gm directory)

### Radiant Compatibility

Radiant < 0.6.9 - No version of this extension has been tested against this version of Radiant
Radiant 0.7.1 - Version 1.3.1 of this is extension is the last Radiant 0.7.1 compatible version at the time of writing

### Installation

After downloading the extension  you may have to rename the directory to "google_maps" then run the following command

  rake radiant:extensions:google_maps:install

After this you will need to edit the config/gmaps_api_key.yml file with your Google Map API Key (Sample file has the key needed for localhost).
The API key file must have entries for dev, test and production environments even if they are not being used.

### Usage

Once installed a new tab will be visible called "Maps". Here you can setup your maps and child objects (Currently only GMarkers).
Marker content can use filters and Radius tags.

When creating or editing a map you can use the map embedded in the form to set the lat/lon and zoom.
- Use the zoom buttons set the soom value.
- Right clicking on the map will set the map center.
- Moving the marker manually will also set the map center.

Currently updating the form fields themselves will not update the map to match
- Right clicking on the map will set the marker position.
- Moving the marker manually will also set the marker position.

When creating or editing a marker you can use the map embedded in the form to set the lat/lon/

Using the map will update the form field values but not vice versa. If you wish to see an updated map based on new form field entries please "save and continue"

### Tags

Two tags are created by the extension

<r:google_map:header /> should be places in the <head> section of your page. This Radius tag creates the HTML JavaScript include tag with your API key necessary to run a google map.

<r:google_map:generate div="Div ID" id="Map ID" name="Map Name" marker_id="Marker ID" marker_name="Marker Name" />

This can be placed anywhere in your document.

The "div" attribute is the html ID of the div you wish to generate the map in.
The "name" and "id" attribute is the name or ID of the map you wish to generate, only one is needed.

The "marker_name" and "marker_id" attribute is the name or ID of the marker you wish to center and zoom the map on, only one is needed. These two attributes are optional; if they are not used the map center is used.

You can use this extension with the location extension( http://github.com/adsmart/radiant-location-extension/tree/master )

<r:google_map:generate div="Div ID" id="Map ID" name="Map Name" marker_id="Marker ID" marker_name="Marker Name">
<r:location name"name of location from location extension"/>
</r:google_map:generate>

Note that this extension does not create or size the div. This is left to the user for easier placement and sizing of div using CSS.

### Thanks - Standing on the shoulders of giants

The Radiant devs for continuing Radiant development and giving us a great CMS.
Sean Cribbs for, as well as the above, putting up with my inane, easily answered questions in IRC.
The makers of GeoRuby, YM4R and the spatial adapter plugin for making it easy to embed google maps into ruby on rails apps.
Everyone else involved in computer development down to Charles Babbage