today_ai_weather/app/views/cities/index.html.erb
songtianlun 8e8c60254f feat: add cities feature with weather arts
- Implement CitiesController for listing and showing cities
- Create City and WeatherArt models with associations
- Add views for cities index and show, displaying weather arts
- Include routes for cities and active storage for images
- Update migrations for weather arts and seed data for testing

This commit introduces a comprehensive cities feature that allows users to view cities along with their associated weather art. The implementation includes necessary database migrations, routes, and controller actions to support this new functionality.
2025-01-18 21:42:31 +08:00

20 lines
633 B
Plaintext

<div class="container mx-auto px-4 py-8">
<h1 class="text-3xl font-bold mb-8">Cities</h1>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<% @cities.each do |city| %>
<div class="card bg-base-100 shadow-xl">
<div class="card-body">
<h2 class="card-title"><%= city.name %></h2>
<p><%= city.country %></p>
<div class="card-actions justify-end">
<%= link_to 'View Weather History', city_path(city),
class: "btn btn-primary" %>
</div>
</div>
</div>
<% end %>
</div>
<%= paginate @cities %>
</div>