How do I edit or override the footer of ActiveAdmin?
Answer:
In your rails app, create this file: app/admin/footer.rb
The content would be something like:
module ActiveAdmin
module Views
class Footer < Component
def build
super :id => "footer"
super :style => "text-align: right;"
div do
small "Cool footer #{Date.today.year}"
end
end
end
end
end
Don't forget! restart the app/server.
Any ActiveAdmin layout component can be customized like this.
More about it:
Why does it work? This is Ruby's magic sauce. We are reopening the definition of the Footer class and changing it for our custom content.
Is it totally customizable? I don't know. This is the inheritance path:
ActiveAdmin
class Component < Arbre::Component
class Footer < Component
Arbre
class Component < Arbre::HTML::Div
This means that we can use Arbre's DSL directly.
If all you want to do is change or delete the 'powered by' message, what you can do is change its value in a locale file. Example, edit config/locales/en.yml
And use something like this:
en:
active_admin:
powered_by: "Powered by hamsters"
Why this works:
The default locale for a rails app is english, the en
locale file.