Skip to content

Commit

Permalink
First (not working properly) version of getting maps and pano to work…
Browse files Browse the repository at this point in the history
… without js
  • Loading branch information
mlandauer committed Oct 1, 2023
1 parent e5e7f8f commit dab28e0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/views/_tailwind/applications/_map.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%# TODO: Use the new library loader for google maps. Might make this a little less ugly %>
<%# TODO: Show static map and pano when javascript is disabled %>
<div class="flex justify-between">
<div x-data
<%# This handles both when google maps is ready before alpine and the other way around %>
Expand All @@ -7,15 +8,20 @@
class="w-full xl:w-[528px] sm:h-[528px] aspect-1 h-auto">
<%= tag.div class: "bg-google-maps-green w-full h-full",
data: { lat: application.lat, lng: application.lng, address: application.address, zoom: 16 },
"x-ref" => "map" %>
"x-ref" => "map" do %>
<noscript><%= google_static_map(application, size: "528x528") %></noscript>
<% end %>
</div>
<div x-data
x-init="if('google' in window) initialisePano($refs.pano)"
x-on:map-loaded.window="initialisePano($refs.pano)"
class="hidden xl:block w-[528px] h-[528px]">
<%= tag.div class: "w-full h-full",
data: { lat: application.lat, lng: application.lng, address: application.address },
"x-ref" => "pano" %>
"x-ref" => "pano" do %>
<%# TODO: The no javascript version of streetview isn't working for some reason %>
<noscript><%= google_static_streetview(application, size: "528x528") %></noscript>
<% end %>
</div>
</div>

Expand Down

0 comments on commit dab28e0

Please sign in to comment.