gmaps4rails上的Infowindows仅显示在主页上

时间:2012-03-23 22:21:15

标签: ruby-on-rails-3.1 gmaps4rails

遇到问题' infowindows'在所有有地图的页面上显示。目前我正在使用wiki中的确切代码来显示自定义信息窗口,但是在点击单个标记时显示它们的唯一地图是主页。我有4个控制器/型号,显示标记没有问题,但没有infowindows。奇怪的是,当在主页地图上调用时,每个控制器/模型都可以正常工作。这是一些来源......

在模型中(每个模型类似)

def gmaps4rails_infowindow
    "<h5><a href='/dinings/#{slug}'>#{self.name}</h5><br />Cuisine: #{self.cuisine}</a>"
end

在回调中:

Gmaps.map.infobox = function(boxText) {
  return {
     content: boxText
    ,disableAutoPan: false
    ,maxWidth: 0
    ,pixelOffset: new google.maps.Size(-140, 0)
    ,zIndex: null
    ,boxStyle: { 
      background: "url('http://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/examples/tipbox.gif') no-repeat"
      ,opacity: 0.95
      ,width: "280px"
       }
    ,closeBoxMargin: "10px 2px 2px 2px"
    ,closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif"
    ,infoBoxClearance: new google.maps.Size(1, 1)
    ,isHidden: false
    ,pane: "floatPane"
    ,enableEventPropagation: false
 }};

Homescreen gmaps call:

<%= gmaps(:map_options => {:detect_location => true, :center_on_user => true, :auto_zoom => false, :zoom => 17, :scrollwheel => false, :auto_adjust => false}, :markers => {:data => @json, :options => {"custom_infowindow_class" => "yellow", :randomize => true, :max_random_distance => 15 }} ) %>

个人控制器电话:

<%= gmaps(:map_options => {:detect_location => true, :center_on_user => true, :auto_zoom => false, :zoom => 15, :auto_adjust => true}, :markers => {:data => @json, :options => {"custom_infowindow_class" => "yellow", :randomize => true, :max_random_distance => 10}}) %>

最重要的是,所有显示的都是标记下方的一个小的5px框边框,所以我知道有些东西在显示,但不是全部。

感谢您的帮助!

0 个答案:

没有答案
相关问题