Last active
August 29, 2015 14:01
-
-
Save pokonski/2af21bb203d19a050a71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div style='width: 800px;'> | |
<div id="map" style='width: 800px; height: 400px;'></div> | |
</div> | |
<script type="text/javascript"> | |
function displayOnMap(position){ | |
var marker = handler.addMarker({ | |
lat: position.coords.latitude, | |
lng: position.coords.longitude | |
}); | |
handler.map.centerOn(marker); | |
}; | |
handler = Gmaps.build('Google'); | |
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ | |
if(navigator.geolocation) | |
navigator.geolocation.getCurrentPosition(displayOnMap); | |
handler.addMarkers(<%= raw @points.to_json %>); | |
}); | |
//aktualizacja 4 | |
google.maps.event.addListener(handler.getMap(), 'click', function(event){ | |
var marker = handler.addMarker({ | |
lat: event.latLng.lat(), | |
lng: event.latLng.lng() | |
}); | |
$.ajax({ | |
url: '<%= points_path %>', | |
method: 'post', | |
data: { | |
point: { | |
latitude: event.latLng.lat(), | |
longitude: event.latLng.lng(), | |
route_id: <%= @route.id %>, | |
} | |
} | |
}); | |
}); | |
// koniec aktualizacja | |
//aktualizacja 3 | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lat: 51.02482312853735 | |
lng: 17.14691162109375 | |
lat: 51.06108759210944 | |
lng: 17.244415283203125 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def edit | |
@points = Gmaps4rails.build_markers(@route.points) do |point, marker| | |
marker.lat point.latitude | |
marker.lng point.longitude | |
end | |
end |
<%= link_to "Strona główna", root_path %> - <%= link_to "Trasy", routes_path %>
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name">
<h1><a href="#">My Site</a></h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<section class="top-bar-section">
<!-- Right Nav Section -->
<ul class="right">
<li class="active"><a href="#">Right Button Active</a></li>
<li class="has-dropdown">
<a href="#">Right Button Dropdown</a>
<ul class="dropdown">
<li><a href="#">First link in dropdown</a></li>
</ul>
</li>
</ul>
<!-- Left Nav Section -->
<ul class="left">
<li><a href="#">Left Nav Button</a></li>
</ul>
</section>
</nav>
<script src="//maps.google.com/maps/api/js?v=3.13&sensor=false&libraries=geometry" type="text/javascript"></script>
<script src='//google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.14/src/markerclusterer_packed.js' type='text/javascript'></script>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Foundation: https://github.com/zurb/foundation-rails
Dokumentacja foundation: http://foundation.zurb.com/docs/