tbranyen/backbone.layoutmanager — pull request #348 by ssafejava (2013-05-15 10:10:37+00:00)
Title: Added `insertBefore` parameter to insertView().

It is often useful to update a collection of views in place without rerendering the bunch.

A simple way of doing that is the following code:

```javascript
parentView.insertView('.container', new ChildView()).render() // renders child at bottom
```

The above code will not rerender the entire parent view, but successfully inserts a new view and appends it to the bottom of `.container`.

This patch adds an optional `insertBefore` parameter that indicates where the inserted view should be placed. If 0, it is at the beginning of the list; if > list.length, it is at the end; if negative, it is counted backwards from the end of the list.

```javascript
parentView.insertView('.container', new ChildView(), 1).render(); // renders after first item
```

Tests are included.