Sha256: 7cb4218791a64b681312691cbc13f1f22ad15f452524c7ad3f88b73ee5031e21

Contents?: true

Size: 1.52 KB

Versions: 2

Compression:

Stored size: 1.52 KB

Contents

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Twhere</title>

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=<%= @google_maps_api_key %>" type="text/javascript">
</script>

<script type="text/javascript">
function initialize() {
  if(GBrowserIsCompatible()) {

    function createMarker(latlng, name) {
      var marker = new GMarker(latlng);
      marker.value = name;
      GEvent.addListener(marker,"click", function() { map.openInfoWindowHtml(latlng, name); });
      return marker;
    }

    var points = new Array();
<% for location, latlng in @locations %>
    points["<%= location %>"] = new GLatLng(<%= latlng %>);
<% end %>

    var map = new GMap2(document.getElementById("map"), {mapTypes: [G_PHYSICAL_MAP]});

<% for location, tweets in @located_tweets %>
<% text = tweets.sort {|a, b| -(a[:twitter_id].to_i <=> b[:twitter_id].to_i) }.map {|t| t[:text]}.join("<br />") %>
    map.addOverlay(createMarker(points["<%= location %>"], "<h1><%= location %></h1><p><%= text %></p>"));
<% end %>

    map.setCenter(points["center"], 13);
    map.setUIToDefault();
  }
}
</script>

<style>
*
{
  border: 0px;
  margin: 0px;
  padding: 0px;
}
html, body
{
  width: 100%;
  height: 100%;
}
</style>

</head>

<body onload="initialize()" onunload="GUnload()">
<div id="map" style="width: 100%; height: 100%"></div>
</body>

</html>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sarnesjo-twhere-0.0.5 examples/template.html.erb
sarnesjo-twhere-0.0.7 examples/template.html.erb