我正在 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)?
最佳答案
这个 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
关于css - 事件管理 - 从右到左过滤 - 表格滚动条 - css/布局/结构更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17400802/