From 829da14401d9143a2ece699939f96733d9b44416 Mon Sep 17 00:00:00 2001 From: Pablo Brasero Date: Thu, 28 Dec 2023 14:36:57 +0000 Subject: [PATCH] Document the feature --- docs/customizing_page_views.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/customizing_page_views.md b/docs/customizing_page_views.md index 34db88c3b9..1aa7d021cf 100644 --- a/docs/customizing_page_views.md +++ b/docs/customizing_page_views.md @@ -94,3 +94,25 @@ rails generate administrate:views:layout # It only generates the sidebar partial # -> app/views/admin/application/_navigation.html.erb ``` + +## Adding custom CSS and JS + +You can add custom CSS and JS to Administrate. Put the the files in the +appropriate folders (typically under `assets`) and point Administrate to them +using the following API, preferably in an initializer: + +``` +/// config/initializers/administrate.rb +// Point Administrate to admin.css and admin.js +Administrate::Engine.add_stylesheet("admin") +Administrate::Engine.add_javascript("admin") +``` + +Then make sure to list them in your manifest file (Rails will helpfully remind +you of this step if you miss it): + +``` +/// app/assets/config/manifest.js +//= link admin.css +//= link admin.js +```