background preloader

CMS

Facebook Twitter

Ruby on rails - Use Carrierwave with Active Admin. Ruby on rails - ROR + ActiveAdmin + Carrierwave, editing after uploading multiple images. Ruby on rails - Image file input with Formtastic and ActiveAdmin. The administration framework for Ruby on Rails. Active Admin allows you to override and modify the underlying controller which is generated for you.

The administration framework for Ruby on Rails

There are helpers to add collection and member actions, or you can drop right in to the controller and modify its behavior. Collection Actions A collection action is a controller action which operates on the collection of resources. This method adds both the action to the controller as well as generating a route for you. To add a collection action, use the collection_action method: ActiveAdmin.register Post do collection_action :import_csv, :method => :post do # Do some CSV importing work here... redirect_to {:action => :index}, {:notice => "CSV imported successfully! "} This collection action will generate a route at “/admin/posts/import_csv” pointing to the Admin::PostsController#import_csv controller action. Member Actions A member action is a controller action which operates on a single resource.

For example, to add a lock action to a user resource, you would do the following: Rails ActiveAdmin - change the after update redirect_to. Adding Custom Buttons To Active Admin « Ruby On Rails Gotchas. #284 Active Admin. Active Admin allows you to quickly build an admin interface with just a few commands.

#284 Active Admin

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) Seamless Rails menu entries across ActiveAdmin and Resque Web - Brizzled. For one of my clients, I built a customer web portal in Rails, and I used the ActiveAdmin gem to provide a slick administrative interface.

Seamless Rails menu entries across ActiveAdmin and Resque Web - Brizzled

The site also uses Resque to process background jobs, and the Resque web interface is mounted within the Rails application. With these components in place, I wanted to provide cross-linking navigation menu (“navbar”) items within the application itself, within ActiveAdmin, and within the Resque web engine. The application navbar is easy, of course, since it’s entirely under my control. Adding links to Resque web and ActiveAdmin navbars is more challenging. Here’s how I did it. I wanted the Resque Web navbar to contain two additional links: “Live Site” links back to the application. Adding these links turns out to be ugly, but workable. This is a complete hack. I need to augment it to use the Rails helpers, to decouple it from the Rails routes.rb file. By default, ActiveAdmin provides a “Live Site” navbar link that points back to the main application. The administration framework for Ruby on Rails.

When you need a standalone page on your site, Custom Pages will be there with a familiar syntax to resource registration.

The administration framework for Ruby on Rails

Available Features main page content menu item sidebars action_items page_actions Create a new Page Creating a page is a simple as calling the register_page method: ActiveAdmin.register_page "My Page" do content do para "Hello World" end end In the above example, a new page will be created at /admin/my_page with the title “My Page” and the content of “Hello World”. Page Title & I18n Coming soon… The menu item is available to customize just like any other resource in Active Admin. You can add sidebar sections to your pages using the same DSL as other resources in Active Admin: ActiveAdmin.register_page "My Page" do sidebar :help do ul do li "First Line of Help" end end content do para "Hello World" end end.