WARNING: this component is just a proof of concept, it can be useful for experimental purposes.
An Active Admin plugin to use Simple Form in place of Formtastic in edit views.
- 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_errorsdo |b|
b.use:html5b.use:placeholderb.optional:maxlengthb.optional:minlengthb.optional:patternb.optional:min_maxb.optional:readonlyb.use:label_inputb.use:hint,wrap_with: {tag: :span,class: :hint}b.use:error,wrap_with: {tag: :span,class: :error}end- Author model example:
formdo |f|
f.inputs'Informations'dof.input:namef.input:agef.association:country# using input for associations is not supportedf.has_many:articlesdo |ff|
ff.input:titleff.input:descriptionff.input:publishedff.input:_destroy,as: :boolean,required: falseunlessff.object.new_record?endendf.actionsendIf 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.
- Mattia Roccoberton - creator, maintainer