beck03076
beck03076

Reputation: 3308

Active admin - Filters from right to left - Table Scroll bar - css/layout/structure changes

I'm using active admin gem on Rails. I haven't gone through everything, yet.

2 clarifications:

  1. I want to display the filters section (:id => "filters_sidebar_section") to my left hand side. By default, this is displayed to my right hand side.
  2. Can I limit the table width, so that a scroll bar is displayed at the bottom of the table and if my table has like 30 columns, I can use the scroll bar to reach the 30th column?

Upvotes: 2

Views: 2560

Answers (1)

Fivell
Fivell

Reputation: 11929

this gem can halp you managing sidebar https://github.com/Fivell/active_admin_sidebar

gem install active_admin_sidebar

easy change sidebar position with activeadmin (tested with activeadmin ~> 1.0.0.pre)

Add including of css file

@import "active_admin_sidebar";

to the app/assets/stylesheets/active_admin.css.scss

Changing sidebar position dynamically with before_filter

# app/admin/posts.rb
ActiveAdmin.register Post do
  before_filter :left_sidebar!, only: [:show]
end

# app/admin/comments.rb
ActiveAdmin.register Comment do
  before_filter :right_sidebar!
end

Moving sidebar to the left within all resource (config/initializers/active_admin.rb)

# == Controller Filters
#
# You can add before, after and around filters to all of your
# Active Admin resources from here.
#
config.before_filter do
  left_sidebar! if respond_to?(:left_sidebar!)
end

Disabling using sidebar layout on dashboards (if you setup sidebar position with initializer)

ActiveAdmin.register_page "Dashboard" do
  controller {skip_before_filter :left_sidebar!}
  #.....
end

Upvotes: 3

Related Questions