2

我在 Rails 上使用活动管理 gem。我还没有经历一切。

2 说明:

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(Like you used to read this entire question)?
4

1 回答 1

3

这个 gem 可以阻止你管理侧边栏 https://github.com/Fivell/active_admin_sidebar

gem install active_admin_sidebar

使用 activeadmin 轻松更改侧边栏位置(使用 activeadmin ~> 1.0.0.pre 测试)

添加包含的css文件

@import "active_admin_sidebar";

到 app/assets/stylesheets/active_admin.css.scss

使用 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

在所有资源中向左移动侧边栏 (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

禁用在仪表板上使用侧边栏布局(如果您使用初始化程序设置侧边栏位置)

ActiveAdmin.register_page "Dashboard" do
  controller {skip_before_filter :left_sidebar!}
  #.....
end
于 2013-07-11T12:37:52.550 回答