today_ai_weather/app/views/cities/_map.html.erb
songtianlun b6635e5a51 fix: fix map marker click and handle null values
-   Comment out marker click listener to fix a bug
-   Update _map.html.erb to handle null values in the city
-   Improve error handling

This commit addresses a bug where clicking the map marker
caused unexpected behavior.  The changes involve commenting out
the click listener to fix the issue, and updating the view
template to handle potential null values in the city object to
prevent unexpected behavior.
2025-02-15 11:48:40 +08:00

16 lines
864 B
Plaintext

<!-- 插入到 "主要统计信息" 的下方 -->
<div class="container mx-auto px-2 my-16">
<div class="max-w-7xl mx-auto bg-base-100 rounded-2xl shadow-xl overflow-hidden">
<!-- <h3 class="text-2xl font-display font-bold p-6 bg-base-200"><%#= t('city.location_on_globe') %></h3>-->
<div
data-controller="map"
data-map-latitude-value="<%= @city.latitude %>"
data-map-longitude-value="<%= @city.longitude %>"
data-map-token-value="<%= Rails.application.credentials.dig(:mapbox, :token) %>"
data-map-weather-art-value="<%= @city.latest_weather_art.to_json %>"
data-map-weather-art-url-value="<%= rails_blob_url(@city&.latest_weather_art&.webp_image&.processed ) if @city&.latest_weather_art&.image&.attached %>"
class="h-[500px] w-full rounded-b-2xl z-10"
style="touch-action: none"
></div>
</div>
</div>