Skip to content

sscherban/active_admin-form_errors

 
 

Repository files navigation

ActiveAdmin Form Errors

Pretty form errors by default in your ActiveAdmin.

Installation

1. Import gem

gem 'active_admin-form_errors'

2. Import stylesheets (change app/assets/stylesheets/active_admin.scss)

@import 'active_admin/form_errors';

Options

Disable it in a specific resource

ActiveAdmin.register User do
  config.form_errors = false
end

Disable by default at all resources (change config/initializers/active_admin.rb)

ActiveAdmin.setup do
  config.form_errors = false
end

Show only specific errors

ActiveAdmin.register User do
  config.form_errors = lambda do
    if current_user.admin?
      resource.errors.keys
    else
      [:name, :email]
    end
  end
end

Change the color base

$form-errors-color: red; // must be before the import

@import 'active_admin/form_errors';

Maintainer

Dhyego Fernando

About

Pretty form errors by default in your ActiveAdmin. 💄

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 87.8%
  • SCSS 12.2%