Alex Rivera | Logout

Reskinning ActiveAdmin using Bootstrap

Asked 2013-07-17T02:31:03.517
9

I want to re-skin ActiveAdmin using a Bootstrap template theme. However I need to change the layout of the page to suit.

Is it possible to override the layout of ActiveAdmin to suit what I want? It looks different to normal rails conventions - I'd rather just accomplish it using a regular template and then yield the parts of the content that I need in the order that I need them.

Edit
Report

1 Answer

12

Ive done something similar before. Check out this Gist https://gist.github.com/bigfive/6017435

Essentially you patch the active admin base controller to use your new layout by overriding their :determine_active_admin_layout method

# config/initializers/active_admin_patch.rb
module ActiveAdmin
  class BaseController
    def determine_active_admin_layout
      'active_admin_reskin'
    end
  end
end

Then in your active_admin_reskin layout you can call methods on the Arbre view_factory like so

view_factory[#{params[:action]}_page"].new(Arbre::Context.new(assigns, self)).send(:build_header)

In the gist(https://gist.github.com/bigfive/6017435) Ive made a little view helper for making it easy to call those methods.

Have a look through the active admin source code to see which methods are available to you on various Arbre documents, especially here: https://github.com/gregbell/active_admin/blob/master/lib/active_admin/views/pages/base.rb

Once the markup is changed the way you like, you can @include 'bootstrap' into your active_admin.css.scss file that the generator created and go nuts.

answered 2013-07-17T03:40:42.683

Your Answer