Closed iRonin closed 13 years ago
Yep, could be done. Something like:
<%= gmaps(:map_options => { :raw => json } ) %>
Should do!
If you'd like to keep the naming present currently in your code I'd replace :raw
with something like :service_map_options
.
Was rethinking about that and I came to this conclusion:
It could end_up with the following:
<%= gmaps(:markers => { :data => '[ {"lat": "10", "lng": "20", "title": "my title"} ]',
:options => { :default => '{ "flat": true, "title": "default"}' } } )
%>
Then in the js, I could merge provided argument with defaults with precedence given to data provided.
The result of the previous example would be: {"lat": "10", "lng": "20", "title": "my title", "flat": true}
.
Your point of view?
Sounds good. Since we're discussing markers – perhaps you could do the same as for map options: make it possible to pass service marker options along, thus making things like animation possible.
I ended with this syntax:
<%= gmaps(:map_options => { :raw => json } ) %>
Since foo.default
leads to bug in Internet explorer.
Great! I like it a lot! Thank you very much! Coffeescript looks good as well!
Me again :)
Would you consider adding more map options or to make map initialization more flexible? I need for instance to add a scale control to my map. It can be done only on map initialization. This parameter is not currently present in gem's map options nor I can use callback function.
Perhaps one could pass a hash that would be translated 1:1 to google.maps.MapOptions making initialization ultimately flexible, what do you think?