Last active
August 24, 2017 03:36
-
-
Save hernandezalek/200e1aa57297c63544472557f6b762ad to your computer and use it in GitHub Desktop.
This file contains 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
$(document).ready(function(){ | |
$(document).foundation(); | |
$(document).on('change.zf.tabs', '[data-active-collapse]', function () { | |
window.dispatchEvent(new Event('resize')); | |
}); | |
}); |
This file contains 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 index | |
@homes = Home.all | |
@hash = Gmaps4rails.build_markers(@homes) do |home, marker| | |
marker.lat home.latitude | |
marker.lng home.longitude | |
end | |
end |
This file contains 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 class="tabs-panel" id="geolocation"> | |
<div id="map" style='width: 100%; height: 300px;'></div> | |
<script type="text/javascript"> | |
handler = Gmaps.build('Google'); | |
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){ | |
markers = handler.addMarkers(<%=raw @hash.to_json %>); | |
handler.map.centerOn(markers) | |
handler.bounds.extendWith(markers); | |
handler.fitMapToBounds(); | |
handler.getMap().setZoom(16); | |
}); | |
</script> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment