Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reskinning ActiveAdmin using Bootstrap

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.

like image 860
nocache Avatar asked Jul 17 '13 02:07

nocache


1 Answers

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.

like image 115
BigFive Avatar answered Sep 27 '22 19:09

BigFive