Skip to content

Instantly share code, notes, and snippets.

@stephancom
Created December 7, 2019 03:39
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/9e46bd476a3553ce65b10d0a455fc6bf to your computer and use it in GitHub Desktop.
Save stephancom/9e46bd476a3553ce65b10d0a455fc6bf 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