Sha256: 0fe757cea267e5dd53f3de8f10ad947955b1d95e3a90dadb83472a487332bd6a

Contents?: true

Size: 1.03 KB

Versions: 20

Compression:

Stored size: 1.03 KB

Contents

# Customizing the Form

Active Admin gives complete control over the output of the form by creating a thin DSL on top of
the fabulous DSL created by Formtastic (http://github.com/justinfrench/formtastic).

    ActiveAdmin.register Post do

      form do |f|
        f.inputs "Details" do
          f.input :title
          f.input :published_at, :label => "Publish Post At"
          f.input :category
        end
        f.inputs "Content" do
          f.input :body
        end
        f.buttons
      end

    end

Please view the documentation for Formtastic to see all the wonderful things you can do:
http://github.com/justinfrench/formtastic

If you require a more custom form than can be provided through the DSL, you can pass
a partial in to render the form yourself.

For example:

    ActiveAdmin.register Post do
      form :partial => "form"
    end

Then implement app/views/admin/posts/_form.html.erb:

    <%= semantic_form_for [:admin, @post] do |f| %>
      <%= f.inputs :title, :body %>
      <%= f.buttons :commit %>
    <% end %>

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
activeadmin-0.5.1 docs/5-forms.md
activeadmin-0.5.0 docs/5-forms.md
activeadmin-0.5.0.pre1 docs/5-forms.md
activeadmin-0.5.0.pre docs/5-forms.md
activeadmin-0.4.4 docs/5-forms.md
activeadmin-0.4.3 docs/5-forms.md
activeadmin-0.4.2 docs/5-forms.md
activeadmin-0.4.1 docs/5-forms.md
activeadmin-0.4.0 docs/5-forms.md
andrewroth_activeadmin-0.3.4.4 docs/5-forms.md
andrewroth_activeadmin-0.3.4.3 docs/5-forms.md
andrewroth_activeadmin-0.3.4.2 docs/5-forms.md
andrewroth_activeadmin-0.3.4.1 docs/5-forms.md
andrewroth_activeadmin-0.3.4 docs/5-forms.md
activeadmin-0.3.4 docs/5-forms.md
activeadmin-0.3.3 docs/5-forms.md
activeadmin-0.3.2 docs/5-forms.md
activeadmin-0.3.1 docs/5-forms.md
activeadmin-0.3.0 docs/5-forms.md
nsm-activeadmin-0.2.2 docs/5-forms.md