How can I customize the active admin layout?

后端 未结 5 969
梦如初夏
梦如初夏 2021-01-31 09:42

I need to customize the active admin layout, but how can I do it?

5条回答
  •  不知归路
    2021-01-31 10:39

    Maybe ActiveAdmin does provide a nicer way to do this by now? I don't know. However here would be an example for a bit cleaner patch for that situation, in my example to add the webpacker gems javascript_pack_tag to my admin area.

    module MyApp
      module ActiveAdmin
        module Views
          module Pages
            module BaseExtension
              def build_active_admin_head
                super
                within @head do
                  text_node(javascript_pack_tag('application'))
                end
              end
            end
          end
        end
      end
    end
    
    class ActiveAdmin::Views::Pages::Base < Arbre::HTML::Document
      prepend MyApp::ActiveAdmin::Views::Pages::BaseExtension
    end
    

提交回复
热议问题