2

I am trying to change the structure and design of the components of the ActiveAdmin layout, such as the navbar menu, icons and customize it to my style. Is this possible?

I need to overwrite the source code to be able to change the HTML structure, but I have tried to do it by placing files in the / lib folder and I have not succeeded. How could I overwrite the ActiveAdmin source code within my Rails project?

3
  • 2
    Why did you place them in the lib folder? Rails will first look for view files in the views folder of your project, then in the folders of the gems (ActiveAdmin in this case). So, if you place a file your views folder that has the identical name and structure to the ActiveAdmin view file you want to "override", rails will render your view instead of the ActiveAdmin view. Commented Nov 6, 2019 at 16:00
  • Yes, that's right. But in this case ActiveAdmin has a peculiar structure in its core, where the views and everything related to its layout is implemented through raw Ruby code, with files that I cannot place directly in the /views folder Commented Nov 6, 2019 at 16:09
  • Yes, re-defining or patching classes like ActiveAdmin::Views::Pages::Base is required, but see my answer. Commented Nov 7, 2019 at 19:05

1 Answer 1

2

It is possible but many developers have discovered it is not easy. If you look through the various plugins you will find examples like Custom Layout, Sidebar, Menu and SubNav that may inspire you. However, if you are new to ActiveAdmin and your first priority is to customize the layout heavily then consider Administrate or vanilla Rails instead: they are still difficult, but you will be fighting the framework less.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.