Merge branch 'dev'
This commit is contained in:
commit
15d64b94b0
@ -1,5 +1,10 @@
|
||||
ActiveAdmin.register_page "Ahoy Dashboard" do
|
||||
menu label: "总览", parent: "数据统计", priority: 1
|
||||
page_action :toggle_city_status, method: :post do
|
||||
city = City.find(params[:city_id])
|
||||
city.update(active: !city.active)
|
||||
redirect_back(fallback_location: admin_dashboard_path, notice: "城市状态已更新")
|
||||
end
|
||||
|
||||
content title: "总览" do
|
||||
columns do
|
||||
@ -36,7 +41,14 @@ ActiveAdmin.register_page "Ahoy Dashboard" do
|
||||
table_for City.least_popular_active.limit(10) do
|
||||
column("城市") { |city| link_to(city.name, admin_city_path(city)) }
|
||||
column("访问量") { |city| city.view_count }
|
||||
column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") }
|
||||
# column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") }
|
||||
column("操作") { |city|
|
||||
button_to "停用",
|
||||
admin_ahoy_dashboard_toggle_city_status_path(city_id: city.id),
|
||||
method: :post,
|
||||
data: { confirm: "确定要停用 #{city.name} 吗?" }
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -48,6 +60,12 @@ ActiveAdmin.register_page "Ahoy Dashboard" do
|
||||
column("访问量") { |city| city.view_count }
|
||||
column("状态") { |city| status_tag(city.active? ? "活跃" : "停用") }
|
||||
column("所属区域") { |city| city.country.region.name }
|
||||
column("操作") { |city|
|
||||
button_to "激活",
|
||||
admin_ahoy_dashboard_toggle_city_status_path(city_id: city.id),
|
||||
method: :post,
|
||||
data: { confirm: "确定要激活 #{city.name} 吗?" }
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user