nathanvda/cocoon — pull request #30 by silent-e (2011-12-06 20:30:14+00:00)
Title: Expand insertion methods and formatting tweaks

HI Nathan. I needed more functionality regarding how to insert the new content. In my site, I have a table row I want inserted as a child of a tbody that I have set as the insertion-node. However `before` and `after` put the content as a sibling instead of a child.

So I have given you the ability to use `before`, `after`, `append`, `prepend`. I've confirmed that those four work in my own app. There is no code that denies them using `wrap` or others though I don't think they'll work. Caveat emptor IMHO. I have updated the README regarding this recommended limitation.

To do this though, I added `data-association-insertion-method`. `-position` still works until you decide to remove it or just undo what I did and go back to it. I thought `-method` was more appropriate as `append` and `prepend` aren't "positions". `-method` takes precedence.

I also thought I'd give you some syntax highlighting in the README.

Keep up the great work. I switched to this from trying Ryan Bates' nested_form but cocoon is more flexible.

matte