#284 Active Admin
Sep 19, 2011 | 12 minutes | Administration, Plugins
Active Admin allows you to quickly build an admin interface with just a few commands. Not only does it look great, but it is very customizable as shown in this episode.
- Download:
- source codeProject Files in Zip (97.3 KB)
- mp4Full Size H.264 Video (24 MB)
- m4vSmaller H.264 Video (14.9 MB)
- webmFull Size VP8 Video (20.4 MB)
- ogvFull Size Theora Video (35.1 MB)
Resources
bash
bundle
rails g active_admin:install
rake db:migrate
rails g active_admin:resource product
bundle rails g active_admin:install rake db:migrate rails g active_admin:resource product
Gemfile
gem 'activeadmin'
gem 'activeadmin'
app/admin/products.rb
ActiveAdmin.register Product do
scope :unreleased
index do
column :name
column :category
column "Release Date", :released_at
column :price, :sortable => :price do |product|
div :class => "price" do
number_to_currency product.price
end
end
default_actions
end
end
ActiveAdmin.register Product do scope :unreleased index do column :name column :category column "Release Date", :released_at column :price, :sortable => :price do |product| div :class => "price" do number_to_currency product.price end end default_actions end end
app/admin/dashboards.rb
ActiveAdmin::Dashboards.build do
section "Recent Products" do
table_for Product.order("released_at desc").limit(5) do
column :name do |product|
link_to product.name, [:admin, product]
end
column :released_at
end
strong { link_to "View All Products", admin_products_path }
end
end
ActiveAdmin::Dashboards.build do section "Recent Products" do table_for Product.order("released_at desc").limit(5) do column :name do |product| link_to product.name, [:admin, product] end column :released_at end strong { link_to "View All Products", admin_products_path } end end
app/assets/stylesheets/application.css.scss
@import "products";
@import "products";
config/initializers/active_admin.rb
config.site_title = "Ryan's Store"
config.site_title = "Ryan's Store"
