songtianlun
ce5d09b621
- Add menu labels and parents for AdminUser, City, Country, Region, WeatherArt, Ahoy::Event, and Ahoy::Visit. - Introduce a new page for managing Sidekiq jobs, providing functionality to execute or delete scheduled jobs. - Adjust batch job for generating weather art by using Sidekiq for improved performance. - Implement clean-up worker for old Ahoy data and functionalities for refreshing the sitemap. These changes enhance the administration interface by providing better organization and management tools for backend entities. The addition of Sidekiq jobs management further improves system maintenance capabilities.
55 lines
1.3 KiB
Ruby
55 lines
1.3 KiB
Ruby
ActiveAdmin.register City do
|
|
menu label: "City Manager", parent: "系统管理"
|
|
controller do
|
|
def find_resource
|
|
scoped_collection.friendly.find(params[:id])
|
|
end
|
|
end
|
|
|
|
# See permitted parameters documentation:
|
|
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
|
#
|
|
# Uncomment all parameters which should be permitted for assignment
|
|
#
|
|
permit_params :name, :country_id, :latitude, :longitude, :active, :priority, :timezone, :last_weather_fetch, :last_image_generation, :slug
|
|
#
|
|
# or
|
|
#
|
|
# permit_params do
|
|
# permitted = [:name, :country, :latitude, :longitude, :active, :priority, :timezone, :region, :last_weather_fetch, :last_image_generation, :slug]
|
|
# permitted << :other if params[:action] == 'create' && current_user.admin?
|
|
# permitted
|
|
# end
|
|
|
|
index do
|
|
selectable_column
|
|
id_column
|
|
column :name
|
|
column :country
|
|
column :region do |city|
|
|
city.region
|
|
end
|
|
column :latitude
|
|
column :longitude
|
|
column :active
|
|
actions
|
|
end
|
|
|
|
filter :name
|
|
filter :active
|
|
filter :country, as: :select
|
|
|
|
form do |f|
|
|
f.inputs do
|
|
f.input :active
|
|
f.input :name
|
|
f.input :country
|
|
f.input :latitude
|
|
f.input :longitude
|
|
f.input :priority
|
|
f.input :timezone
|
|
end
|
|
f.actions
|
|
end
|
|
end
|