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
|
2015-12-27 14:35:46 +01:00
|
|
|
|
2019-04-26 18:46:38 +02:00
|
|
|
scope :all
|
|
|
|
scope :active, default: true
|
|
|
|
scope :inactive
|
2015-12-27 14:35:46 +01:00
|
|
|
scope :unmoderated
|
2015-12-27 17:01:43 +01:00
|
|
|
|
2015-12-27 14:35:46 +01:00
|
|
|
config.sort_order = 'updated_at_desc'
|
2014-07-18 17:01:51 +02:00
|
|
|
|
2015-12-27 17:01:43 +01: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
|
2015-02-15 15:50:47 +01:00
|
|
|
column :region
|
2015-12-27 17:01:43 +01:00
|
|
|
column :url
|
|
|
|
column :feed
|
|
|
|
column :contact
|
2019-04-26 17:20:49 +02:00
|
|
|
column :submitter
|
2015-12-27 14:35:46 +01:00
|
|
|
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
|
2019-05-02 15:14:14 +02:00
|
|
|
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
|
2014-10-13 21:53:25 +02:00
|
|
|
row :city
|
2015-02-15 15:50:47 +01:00
|
|
|
row :region
|
2019-04-26 17:20:49 +02:00
|
|
|
h3 Orga.human_attribute_name :description
|
|
|
|
section do
|
|
|
|
simple_format l.description
|
|
|
|
end
|
2015-12-27 17:01:43 +01:00
|
|
|
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
|
2015-12-27 14:35:46 +01:00
|
|
|
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
|
2015-02-15 15:50:47 +01:00
|
|
|
f.input :region
|
2019-04-26 17:20:49 +02:00
|
|
|
f.input :latitude
|
|
|
|
f.input :longitude
|
2015-12-27 17:01:43 +01:00
|
|
|
f.input :description
|
|
|
|
f.input :url
|
|
|
|
f.input :feed
|
|
|
|
f.input :contact
|
2019-04-26 17:20:49 +02:00
|
|
|
f.input :submitter
|
2015-12-27 14:35:46 +01:00
|
|
|
f.input :active
|
2014-07-18 17:01:51 +02:00
|
|
|
end
|
|
|
|
f.actions
|
|
|
|
end
|
2013-12-28 15:45:21 +01:00
|
|
|
end
|