Any way to edit admin views?


(Matthew T Cianciolo) #1

I was wondering if there was a way to add anything to the CMS admin panel. I was hoping to add a link back to the site in the navbar. In the devise question you had an option to remove the Users item. Is there an easy way to add a new item? Thanks again!


(Matthew T Cianciolo) #2

For anyone coming here later I figured this out! I made a file named admin.html.erb in views/layouts/push_type . I copied over the code from the same folder in the github and this let me modify the nav bar!


(Aaron Russell) #3

Sorry for the late reply on this, currently travelling. There is actually a way to programmatically do this. PushType has a small menu builder DSL which for now is undocumented as I’m not sure if it will stay in PushType forever - but in theory it can be used to build menus for the front end of your sites too.

Anyway to add an item to the main admin menu you can do the following (in application.rb):

config.after_initialize do
  # Select the "main" menu
  PushType.menu :main do
    # Append a new item to end of the menu
    item :my_admin do
      text  { 'My admin page' }
      link  { main_app.admin_path }
      link_options data: { turbolinks: false }
    end
  end
end

Field that appears on every page