Skip to content
An Active Admin plugin to use Simple Form in place of Formtastic in edit views
Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
Gemfile
LICENSE.txt 🎉 First commit Mar 4, 2018
README.md
Rakefile 🎉 First commit Mar 4, 2018
activeadmin_simple_form.gemspec 🎉 First commit Mar 4, 2018

README.md

ActiveAdmin SimpleForm Gem Version

An Active Admin plugin to use Simple Form in place of Formtastic in edit views.

WARNING: this component is a Beta version, some Active Admin functionalities could not work as expected

Install

  • Add to your Gemfile: gem 'activeadmin_simple_form'
  • Execute bundle
  • Create the Simple Form config initializer: rails generate simple_form:install
  • Add to the config the wrapper used for the fields in inputs blocks:
  config.wrappers :inputs_container, tag: :li, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b|
    b.use :html5
    b.use :placeholder
    b.optional :maxlength
    b.optional :minlength
    b.optional :pattern
    b.optional :min_max
    b.optional :readonly
    b.use :label_input
    b.use :hint,  wrap_with: { tag: :span, class: :hint }
    b.use :error, wrap_with: { tag: :span, class: :error }
  end

Example

  • Author model example:
  form do |f|
    f.inputs 'Informations' do
      f.input :name
      f.input :age
      f.association :country  # using input for associations is not supported
      f.has_many :articles do |ff|
        ff.input :title
        ff.input :description
        ff.input :published
        ff.input :_destroy, as: :boolean, required: false unless ff.object.new_record?
      end
    end
    f.actions
  end

Do you like it? Star it!

If you use this component just star it. A developer is more motivated to improve a project when there is some interest.

Take a look at other ActiveAdmin components that I made if you are curious.

Contributors

License

MIT

You can’t perform that action at this time.