views:

260

answers:

2

Okay I've read through the plugin comments and the docs as well and I have yet to come up with an answer as to how to do this. Here's my problem I want to use the :info_window_tabs and the :icon option, but I don't know what format to pass my information in. According to the documentation the following code should be correct. Here's my code:

        @mapper.overlay_init(GMarker.new([map.lat, map.lng],
        :title => map.name,
        :info_window_tabs => [
            {:tab => "HTML", :content => @marker_html}, 
            {:tab => "Attachments", :content => "stuff"}],
        :icon => {
                :image => "../images/icon.png"
                 }))

The readme and documentation can be viewed here.

And the relevant ruby file that I am trying to interact with, including the author's comments, can be viewed here.

I have tried the #rubyonrails channel in IRC as well as emailing the author directly and reporting an issue at GitHub. It really is just a question of syntax.

Thanks!

+1  A: 

Okay, so I finally got this figured out. Here's how you do it; :icon accepts a GIcon variable and :info_window_tabs accepts an array of GInfoWindowTabs. Here is how you would declare each with the plugin.

Declare GIcon

    @mapper.icon_global_init(GIcon.new(:image => "../images/civil.png",
       :icon_anchor => GPoint.new(0,0),   
       :shadow => "../images/shadow.png",
       :shadow_size => GSize.new(37,32),
       :info_window_anchor => GPoint.new(9,2)), "civil_icon")

    @civil_icon = Variable.new("civil_icon")

Declare GInfoWindowTab

    @tab1 = GInfoWindowTab.new('Tab 1 Label', 'HTML for inside of tab1')
    @tab2 = GInfoWindowTab.new('Tab 2 Label', 'HTML for inside of tab2')

    @window_tabs = [@tab1, @tab2]

Then in your GMarker declaration just do the following:

    @mapper.overlay_init(GMarker.new([map.lat, map.lng], 
   :title => map.name,
   :icon => @civil_icon,
   :max_width => 300,
   :info_window_tabs => @window_tabs))

And you're done.

Zach
A: 

GREAT! you are my hero. workin ~4 hours. thanks!

Tim Kretschmer