Guest User

Untitled

a guest
Mar 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <div class="container-fluid>
  2. <div class="row">
  3. <div class="banner" id="region-banner>
  4. </div>
  5. <div class="location-container container">
  6. <h3><%= @region.name %> </h3>
  7. </div>
  8. </div>
  9. </div>
  10. <script>document.addEventListener('DOMContentLoaded', app.regions);</script>
  11.  
  12. app.regions = () => {
  13. function init() {
  14. startGoogleMap();
  15. let tabs = document.querySelectorAll("a.tab");
  16. for (let tab of tabs) {
  17. tab.addEventListener("click", tabClicked);
  18. }
  19. document
  20. .querySelector("#region-select_")
  21. .addEventListener("change", selectClicked);
  22. }
  23. let startGoogleMap = () => {
  24. let map = new google.maps.Map(document.getElementById("region-banner"), {
  25. zoom: 7,
  26. // The latitude and longitude to center the map (always required)
  27. disableDefaultUI: true,
  28. gestureHandling: "cooperative",
  29. styles: mapStyle
  30. });
  31. const chicago = new google.maps.Marker({
  32. position: new google.maps.LatLng(39.900705, -86.061112),
  33. map: map,
  34. region: "Illinois",
  35. icon: "/marker.png",
  36. title: "Chicago"
  37. });
  38.  
  39. const baltimore = new google.maps.Marker({
  40. position: new google.maps.LatLng(39.332629, -76.746407),
  41. map: map,
  42. region: "Maryland"
  43. icon: "/marker.png",
  44. title: "Baltimore"
  45. });
  46. let bounds = new google.maps.LatLngBounds();
  47. bounds.extend(cedar.position);
  48. bounds.extend(baltimore.position);
  49. map.fitBounds(bounds);
  50. };
  51. return init();
  52. };
Add Comment
Please, Sign In to add comment