From 0c177174c1174c6803b4771cdbe305d748074172 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 643ade2fb..d7dd1af26 100644 --- a/docs/customizing_page_views.md +++ b/docs/customizing_page_views.md @@ -119,3 +119,25 @@ For example, you can add a button in the middle of the header as follows: <%= render template: 'administrate/application/_index_header', locals: local_assigns %> ``` + +## Adding custom CSS and JS + +You can add custom CSS and JS to Administrate. Put the files in the +appropriate folders (typically under `assets`) and point Administrate to them +using the following API, preferably in an initializer. For example, if your +files are called `admin.css` and `admin.js`: + +``` +/// config/initializers/administrate.rb +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 +```