nathanvda/cocoon — pull request #104 by johnbintz (2012-10-25 19:35:57+00:00)
Title: Formtastic input support and nested form sorting

This commit adds two features:

## Formtastic input support

You can generate an appropriate wrapper for the nested form fields with `input :field, :as => :cocoon`. Handles the `semantic_fields_for` and creates the `div.links` and `link_to_add_association` for you. Makes Formtastic forms a lot faster to build. The Formtastic input has the most minimal of specs, mainly just stubbing calls, as a basic sanity check and to avoid having to "test" Formtastic (I assume that it works as expected). These can be expanded in the future, I'm sure.

I also threw in a stylesheet for ActiveAdmin for Formtatic form fields.

## Nested form sort ordering support

For nested forms that have user-specified sorting, I brought in jQuery UI and added the `:ordered_by` option to Formtastic (should be easy enough to add to other form builders and very easy to add to straight template usage). It marks the nested form container as `$.sortable` and autofills in the specified `:ordered_by` field on the nested form whenever a new nested form is added or the forms are resorted.

_(Sorry for the slightly large commit, I was in full-block hack mode working on this, as I was excited I had come across the project, and I was still coming to grips with Formtastic and how it integrates via gems. If you need it split up for the two different features, let me know.)_