Command Line Reference
#
Generators#
InstallInstalls Adminterface and generates necessary files and migrations
caution
This command will ask for permissions to overwrite files generated by ActiveAdmin. Make sure to review the files carefully and accept them. We recommend you commit your files before running this command to ensure you are aware of the changes made.
$ rails g adminterface:install
Options | Alias | Default | Descriptions |
---|---|---|---|
--skip_comments | false | Skip installation of ActionText for comments | |
--skip_examples | false | Skip adding sample admin files | |
--use_webpacker | true | Install assets with webpacker | |
--version | -v | Adminterface::VERSION | Install with a specific version |
This will:
- Run
rails g adminterface:comments
- Run
rails g adminterface:webpacker
- Overwrite the
admin/dashboard.rb
file
#
CommentsAdd ActionText
to ActiveAdmin::Comment
$ rails g adminterface:comments
This will:
- Install Rails
action_text
andactive_storage
- Create a migration:
drop_body_for_active_admin_comments.rb
- Create an initializer
initializers/active_admin_comment_action_text.rb
tip
- Your existing data is saved inside the
body_backup
column by default - Un-comment the lines inside the
drop_body_for_active_admin_comments.rb
migration file to migrate existing data from theActiveAdmin::Comment
table toActionText::RichText
#
WebpackerInstall Stylesheets and JavaScripts using Webpacker
caution
We don't currently support using Sprockets
$ rails g adminterface:webpacker
Options | Alias | Default | Descriptions |
---|---|---|---|
--version | -v | Adminterface::VERSION | Install with a specific version |
This will:
Add
resolve-url-loader
toenvironment.js
config/webpack/environment.jsconst { environment } = require('@rails/webpacker') environment.loaders.get('sass').use.splice(-1, 0, { loader: 'resolve-url-loader'}) module.exports = environment
Install Adminterface's NPM package via Yarn
$ yarn add @cmdbrew/adminterface
Replace the assets
app/javascript/packs/active_admin.jsimport '../stylesheets/active_admin' import Rails from '@rails/ujs'import '@cmdbrew/adminterface' Rails.start()
app/javascript/stylesheets/active_admin.scss@import "~@cmdbrew/adminterface/src/scss/base";
Set
use_webpacker = true
inactive_admin.rb
.config/initializers/active_admin.rbActiveAdmin.setup do |config| ... config.use_webpacker = true ...end
Remove unnecessary dependencies from ActiveAdmin such as jQuery.
#
ConfigurationsCopies config files into a directory for customization
- Syntax
- Example
$ rails g adminterface:configs [NAMESPACE]
$ rails g adminterface:configs admin/users
This will copy the following files to /config/adminterface/NAMESPACE
:
components.yml
css_classes.yml
See Customizations for usage guides and options.
tip
This command helps you separate configurations for components and CSS classes for individual scopes to keep your code tidy.
#
ViewsCopies view templates for customization
$ rails g adminterface:views
This will copy the following view templates to your application:
active_admin/devise/*
templateskaminari/active_admin/*
templateslayouts/active_admin_logged_out.html.erb
templates