A new style spin for active admin
- Add this to your Gemfile:
gem 'admin_theme'
-
Run
bundle install
. -
Add this line to the file
config/initializers/active_admin.rb
meta_tags_options = { viewport: 'width=device-width, initial-scale=1' }
config.meta_tags = meta_tags_options
config.meta_tags_for_logged_out_pages = meta_tags_options
Install the needed assets with npm or yarn:
yarn add arctic_admin @fortawesome/fontawesome-free
In your active_admin.css
, include the css file:
/*
*= require admin_theme/base
*/
Remove the line *= require active_admin/base
Then restart your webserver if it was previously running.
❗ Remove the line @import "active_admin/base"
If you prefer SCSS, add this to your
active_admin.scss
file:
@import "admin_theme/base";
If you use the
Sass indented syntax,
add this to your active_admin.sass
file:
@import admin_theme/base
In your active_admin.js
, include the js file:
//= require admin_theme/base
❗ Remove the line //= require active_admin/base
In your app/javascript/stylesheets/active_admin.scss
, add the line:
@import '~admin_theme/src/scss/main';
Remove:
@import "~@activeadmin/activeadmin/src/scss/mixins";
@import "~@activeadmin/activeadmin/src/scss/base";
Search for app/javascript/packs/active_admin.js
in your rails project and add the following lines:
import "@fortawesome/fontawesome-free/css/all.css";
import 'admin_theme'
For this, you need to use SASS to customize the theming.
Right now you can change the primary color of the theme by placing the following variable in your active_admin.scss
file:
$primary-color: #2dbb43;
@import "~admin_theme/src/scss/main";
If you use the
Sass indented syntax,
add this to your active_admin.sass
file:
$primary-color: #2dbb43
@import ~admin_theme/src/scss/main
Then restart your webserver if it was previously running.