Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

workgena/active_admin_sidebar

Repository files navigation

ActiveAdmin Sidebar

Provides ability to manipulate sidebar position for ActiveAdmin (tested with ActiveAdmin ~> 1.0.0)

Install

gem 'active_admin_sidebar'
# or latest from GitHub
gem 'active_admin_sidebar', git: 'https://github.com/activeadmin-plugins/active_admin_sidebar.git'

Add including of CSS file

 @import "active_admin_sidebar";

to the

app/assets/stylesheets/active_admin.css.scss

And including of coffee file (optional, need only for collapsed sidebar)

 #= require active_admin_sidebar

to the

app/assets/javascripts/active_admin.js

Configuration per resource

Changing sidebar position dynamically with before_action

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

Global configuration

Moving sidebar to the left within all resource. Set configuration in config/initializers/active_admin.rb

 # == Controller before-actions
 #
 # You can add before, after and around actions to all of your resources
 ActiveAdmin.setup do |config|
 config.before_action do
 left_sidebar! if respond_to?(:left_sidebar!)
 end
 end

Collapsing sidebar

You can use sidebar collapsing. It will add "hide/show" button. Shown/Hidden state is persisted across all pages.

 left_sidebar!(collapsed: true)

You can override button color according to your color theme. For example:

 body.active_admin {
 #active_admin_content.left_sidebar, #active_admin_content.collapsed_sidebar {
 .collapse_btn, .uncollapse_btn {
 background-color: #767270;
 }
 }
 }

Example

Alt text

About

easy change sidebar position with activeadmin

Resources

License

Stars

Watchers

Forks

Packages

Contributors

Languages

  • Ruby 71.9%
  • CSS 20.5%
  • CoffeeScript 7.6%

AltStyle によって変換されたページ (->オリジナル) /