How to add a link back to the application in ActiveAdmin?

前端 未结 3 1269
陌清茗
陌清茗 2021-01-12 08:35

I need to add a few links to certain pages of the application in the ActiveAdmin pages. I can do this using sidebars, but I\'ll have to repeat the code for each of my resour

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-12 09:13

    Thanks @phoet ! Implemented it by overriding the HeaderRenderer instead:

      module ActiveAdmin
        module Views
          class HeaderRenderer
            def to_html
              title + global_navigation + application_link + utility_navigation
            end
    
            def application_link
              link_to('Back to Application', root_url)
            end
          end
        end
      end
    

提交回复
热议问题