From 9865c18d32e67bc42adaddd9c8ca9807295d2dea Mon Sep 17 00:00:00 2001 From: songtianlun Date: Fri, 7 Feb 2025 16:41:23 +0800 Subject: [PATCH] feat: add additional columns to city dashboards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add '图像个数' column to show the count of weather arts. - Add '最后更新时间' column to display the last weather fetch time. These additions enhance the information displayed in the Ahoy Dashboard and Cities admin panel, providing more context for each city. --- app/admin/ahoy_dashboard.rb | 4 ++++ app/admin/cities.rb | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/admin/ahoy_dashboard.rb b/app/admin/ahoy_dashboard.rb index 71044e4..bb3242f 100644 --- a/app/admin/ahoy_dashboard.rb +++ b/app/admin/ahoy_dashboard.rb @@ -47,6 +47,8 @@ ActiveAdmin.register_page "Ahoy Dashboard" do column("访问量") { |city| city.view_count } column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") } column("所属区域") { |city| city.country.name+"/"+city.country.region.name } + column("图像个数") { |city| city.weather_arts.count } + column("最后更新时间") { |city| city.last_weather_fetch } # column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") } column("操作") { |city| button_to "停用", @@ -67,6 +69,8 @@ ActiveAdmin.register_page "Ahoy Dashboard" do column("访问量") { |city| city.view_count } column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") } column("所属区域") { |city| city.country.name+"/"+city.country.region.name } + column("图像个数") { |city| city.weather_arts.count } + column("最后更新时间") { |city| city.last_weather_fetch } column("操作") { |city| button_to "激活", admin_ahoy_dashboard_toggle_city_status_path(city_id: city.id), diff --git a/app/admin/cities.rb b/app/admin/cities.rb index 53895cc..52019b5 100644 --- a/app/admin/cities.rb +++ b/app/admin/cities.rb @@ -32,6 +32,8 @@ ActiveAdmin.register City do column :latitude column :longitude column :active + column("图像个数") { |city| city.weather_arts.count } + column("最后更新时间") { |city| city.last_weather_fetch } actions end