refactor: move map partial to shared directory

- Renamed `app/views/cities/_map.html.erb` to
  `app/views/shared/_map.html.erb`
- Updated references to the map partial in `cities/show.html.erb` and
  `weather_arts/show.html.erb`
- Adjusted the layout in `cities/show.html.erb` and
  `weather_arts/show.html.erb` for visual consistency.

This refactoring improves code reusability and maintainability by
centralizing the map component. It also improves the visual
presentation of the application.
This commit is contained in:
songtianlun 2025-02-15 16:32:58 +08:00
parent 67dcaf7a9d
commit 98a335100b
3 changed files with 13 additions and 7 deletions

View File

@ -10,7 +10,7 @@
</div> </div>
<% end %> <% end %>
<div class="relative max-w-3xl mx-auto px-4 pt-4 "> <div class="relative max-w-6xl mx-auto px-4 pt-4 ">
<%= link_to cities_path, <%= link_to cities_path,
class: "inline-flex items-center btn btn-ghost gap-2 " do %> class: "inline-flex items-center btn btn-ghost gap-2 " do %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
@ -23,7 +23,7 @@
<div class="relative pt-8 pb-8"> <div class="relative pt-8 pb-8">
<div class="container mx-auto px-4"> <div class="container mx-auto px-4">
<div class="max-w-3xl mx-auto text-center space-y-6"> <div class="max-w-6xl mx-auto text-center space-y-6">
<h1 class="text-5xl md:text-6xl font-display font-bold leading-tight"> <h1 class="text-5xl md:text-6xl font-display font-bold leading-tight">
<%= @city.localized_name %> <%= @city.localized_name %>
</h1> </h1>
@ -61,7 +61,9 @@
], as: :stat %> ], as: :stat %>
</div> </div>
<%= render 'cities/map', city: @city %> <div class="card bg-base-100 backdrop-blur-md shadow-lg border border-primary/20 overflow-hidden"> <!-- 调整透明度和阴影 -->
<%= render 'shared/map', city: @city %>
</div>
<%= render 'cities/admin_panel' %> <%= render 'cities/admin_panel' %>
</div> </div>
@ -71,8 +73,8 @@
<!-- 天气艺术历史记录 --> <!-- 天气艺术历史记录 -->
<div class="bg-base-100"> <div class="bg-base-100">
<div class="container mx-auto px-4 py-16"> <div class="container mx-auto px-4 py-8">
<div class="max-w-7xl mx-auto space-y-8"> <div class="max-w-6xl mx-auto space-y-8">
<!-- 标题和更新时间 --> <!-- 标题和更新时间 -->
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4"> <div class="flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<h2 class="text-3xl font-display font-bold">Weather Art History</h2> <h2 class="text-3xl font-display font-bold">Weather Art History</h2>

View File

@ -1,5 +1,5 @@
<!-- 插入到 "主要统计信息" 的下方 --> <!-- 插入到 "主要统计信息" 的下方 -->
<div class="container mx-auto px-2 my-16"> <div class="container mx-auto px-2 py-2">
<div class="max-w-7xl mx-auto bg-base-100 rounded-2xl shadow-xl overflow-hidden"> <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>--> <!-- <h3 class="text-2xl font-display font-bold p-6 bg-base-200"><%#= t('city.location_on_globe') %></h3>-->
<div <div

View File

@ -19,7 +19,7 @@
</div> </div>
<!-- 主要内容 --> <!-- 主要内容 -->
<div class="card bg-base-200/80 backdrop-blur-md shadow-lg overflow-hidden"> <!-- 调整透明度和阴影 --> <div class="card bg-base-100 backdrop-blur-md shadow-lg border border-primary/20 overflow-hidden"> <!-- 调整透明度和阴影 -->
<div class="grid lg:grid-cols-2 gap-6 items-center"> <div class="grid lg:grid-cols-2 gap-6 items-center">
<!-- 图片区域 --> <!-- 图片区域 -->
@ -73,6 +73,10 @@
</div> </div>
</div> </div>
<div class="card bg-base-100 backdrop-blur-md shadow-lg border border-primary/20 overflow-hidden"> <!-- 调整透明度和阴影 -->
<%= render 'shared/map', city: @weather_art.city %>
</div>
<!-- AI Prompt --> <!-- AI Prompt -->
<div class="bg-primary/10 backdrop-blur-md p-6 rounded-lg border border-primary/20"> <div class="bg-primary/10 backdrop-blur-md p-6 rounded-lg border border-primary/20">
<div class="flex items-center gap-3 mb-4"> <div class="flex items-center gap-3 mb-4">