Sha256: 792791112c692ff721e630b30a407172f2975990c7bd45c2ce2f3e0068862354

Contents?: true

Size: 1.79 KB

Versions: 6

Compression:

Stored size: 1.79 KB

Contents

function build_map_and_markers(element) {
  if (!element) element = document.getElementById('map_canvas');
  if (element) {
    var map = new google.maps.Map(element, {
      mapTypeId: google.maps.MapTypeId.<%= (Radiant::Config['event_map.googlemap.type'] || 'ROADMAP').upcase %>,
      mapTypeControlOptions: {
        style: google.maps.MapTypeControlStyle.<%= (Radiant::Config['event_map.googlemap.controlstyle'] || 'DROPDOWN_MENU').upcase %>
      }
    });
    var bounds = new google.maps.LatLngBounds();
  <% venues.each do |venue| %>
    <%- if venue.lat && venue.lng %>
      var location = new google.maps.LatLng("<%= venue.lat %>","<%= venue.lng %>")
      add_marker(map, {
        title : "<%= escape_javascript(venue.title) %>",
        position : location,
      <% if Radiant::Config['event_map.use_calendar_icons?'] && slug = slug_for_venue(venue) %>
        image : "/images/map_icons/<%= slug %>.png",
        shadow : "/images/map_icons/<%= slug %>_shadow.png",
      <% end %>
        description : "<%= escape_javascript(render :partial => 'venue', :object => venue) %>"
      });
      bounds.extend(location);
    <% end %>
  <% end %>
    map.fitBounds(bounds);
  }
}

function add_marker (map, mark) {
  var marker = new google.maps.Marker({ map : map, position : mark['position'], title : mark['title'], icon : mark['image'], shadow : mark['shadow'] });
  var infowindow = new google.maps.InfoWindow({ content : mark['description'] , maxWidth : 400 });
  google.maps.event.addListener(marker, 'click', function() { infowindow.open(map, marker); });
}

if(typeof jQuery == 'function') {
	jQuery.fn.populate_map = function() { this.each(function() { build_map_and_markers(this); }); };
  jQuery(function() { jQuery("#map_canvas").populate_map(); });
} else {
  window.onLoad = build_map_and_markers;
}








Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-event_map-extension-1.4.1 app/views/event_venues/index.js.erb
radiant-event_map-extension-1.4.0 app/views/event_venues/index.js.erb
radiant-event_map-extension-1.3.6 app/views/event_venues/index.js.erb
radiant-event_map-extension-1.3.5 app/views/event_venues/index.js.erb
radiant-event_map-extension-1.3.4 app/views/event_venues/index.js.erb
radiant-event_map-extension-1.3.3 app/views/event_venues/index.js.erb