Skip to content

Instantly share code, notes, and snippets.

@torrick
Created May 23, 2011 13:55
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torrick/986730 to your computer and use it in GitHub Desktop.
Save torrick/986730 to your computer and use it in GitHub Desktop.
Example Active Admin config using auto_link
ActiveAdmin.register Company do
filter :name
filter :customer_type, :as => :check_boxes
index do
column :name, :sortable => :name do |company|
auto_link(company)
end
column :active do |company|
company.active? ? icon(:check) : icon(:x)
end
end
show :title => :name do
panel "Company Details" do
attributes_table_for company do
row :name
row :notes
row(:active) { company.active? ? icon(:check) : icon(:x) }
end
end
if company.app_servers.count > 0
panel "App Servers" do
table_for(company.app_servers) do |t|
t.column(:name) { |server| link_to server.name, admin_company_app_server_path(company, server) }
t.column("Internal IP", :internal_ip)
t.column("External IP", :external_ip)
t.column() { |server| link_to "Edit", edit_admin_company_app_server_path(company, server) }
end
end
else
panel "App Servers" do
link_to 'New App Server', new_admin_company_app_server_path(company)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment