agenda-libre-ruby/app/admin/orga.rb

90 lines
1.6 KiB
Ruby
Raw Normal View History

2015-02-15 17:10:17 +01:00
ActiveAdmin.register Orga do
2019-04-26 17:20:49 +02:00
permit_params :active, :kind_id, :name, :description, :url, :city, :region_id
2019-04-26 18:46:38 +02:00
scope :all
scope :active, default: true
scope :inactive
scope :unmoderated
config.sort_order = 'updated_at_desc'
2014-07-18 17:01:51 +02:00
filter :kind, as: :check_boxes
filter :name
filter :region
2014-07-18 17:01:51 +02:00
index do
2019-04-26 18:46:38 +02:00
column :id do |orga|
link_to orga.id, orga
end
2015-03-17 23:33:20 +01:00
column :kind
2014-07-18 17:01:51 +02:00
column :name
column :city
column :region
column :url
column :feed
column :contact
2019-04-26 17:20:49 +02:00
column :submitter
column :updated_at
2019-04-26 17:20:49 +02:00
column :active
2014-07-18 17:01:51 +02:00
actions
end
2019-04-26 17:20:49 +02:00
csv do
column(:kind) { |o| o.kind.name }
column :name
column :city
column :region
column :url
column :feed
2019-04-26 17:20:49 +02:00
column :contact
column :submitter
column :updated_at
column :active
end
2014-07-18 17:01:51 +02:00
show do |l|
attributes_table do
2015-03-17 23:33:20 +01:00
row :kind
2014-07-18 17:01:51 +02:00
row :name
2019-04-26 17:20:49 +02:00
row :address
row :city
row :region
2019-04-26 17:20:49 +02:00
h3 Orga.human_attribute_name :description
section do
simple_format l.description
end
row :url do
link_to l.url, l.url
end
row :feed do
link_to l.feed, l.feed
end
row :contact do
mail_to l.contact, l.contact
end
row :active
2014-07-18 17:01:51 +02:00
end
active_admin_comments
end
form do |f|
2019-04-26 17:20:49 +02:00
f.semantic_errors
2014-07-18 17:01:51 +02:00
f.inputs do
2015-03-17 23:33:20 +01:00
f.input :kind
2014-07-18 17:01:51 +02:00
f.input :name
2019-04-26 17:20:49 +02:00
f.input :address, as: :string
2014-07-18 17:01:51 +02:00
f.input :city
f.input :region
2019-04-26 17:20:49 +02:00
f.input :latitude
f.input :longitude
f.input :description
f.input :url
f.input :feed
f.input :contact
2019-04-26 17:20:49 +02:00
f.input :submitter
f.input :active
2014-07-18 17:01:51 +02:00
end
f.actions
end
end