Skip to content

Instantly share code, notes, and snippets.

@stephancom
Created December 7, 2019 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephancom/2263181c16c087061de307eb5a65ffdb to your computer and use it in GitHub Desktop.
Save stephancom/2263181c16c087061de307eb5a65ffdb to your computer and use it in GitHub Desktop.
Monkey patch ActiveAdmin to allow sidebars placed at the top
module ActiveAdmin
class DSL
alias bottom_sidebar sidebar
def top_sidebar(name, options = {}, &block)
config.sidebar_sections.prepend ActiveAdmin::SidebarSection.new(name, options, &block)
end
def sidebar(name, options = {}, &block)
if options.delete(:prepend)
top_sidebar(name, options, &block)
else
bottom_sidebar(name, options, &block)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment