today_ai_weather/app/views/cities/index.html.erb
songtianlun c11d10c86a feat: update city display and database schema
- Change city name display to localized name in both index and show views
- Modify schema to use bigint for certain foreign keys
- Correct country codes in seeds for accurate data representation

These changes improve the handling of city names, ensuring they are displayed in the appropriate localized format and ensuring well-typed foreign key relationships in the schema.
2025-01-21 21:29:26 +08:00

35 lines
1.5 KiB
Plaintext

<div class="container mx-auto px-4 py-16">
<div class="text-center mb-16 space-y-4">
<h1 class="text-4xl md:text-5xl font-display font-bold">Explore Cities</h1>
<p class="text-xl text-base-content/70 max-w-2xl mx-auto">
Discover AI-generated weather art from cities around the world
</p>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<% @cities.each do |city| %>
<% latest_art = city.weather_arts.last %>
<div class="card bg-base-100 shadow-xl hover:shadow-2xl transition-all duration-300 group">
<% if latest_art&.image&.attached? %>
<figure class="relative aspect-[16/9] overflow-hidden">
<%= image_tag latest_art.image,
class: "w-full h-full object-cover transform group-hover:scale-105 transition-transform duration-500" %>
<div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
</figure>
<% end %>
<div class="card-body relative">
<h2 class="card-title font-display text-2xl"><%= city.localized_name %></h2>
<div class="text-base-content/70">
<p>Lat: <%= city.latitude %></p>
<p>Long: <%= city.longitude %></p>
</div>
<div class="card-actions justify-end mt-4">
<%= link_to "View Weather Art", city_path(city),
class: "btn btn-primary" %>
</div>
</div>
</div>
<% end %>
</div>
</div>