emberjs/ember.js — pull request #627 by pangratz (2012-03-27 18:34:46+00:00)
Title: Add more view insert methods

This Pull Request introduces additional methods to add a view to DOM. Besides the existing `append`, `appendTo` and `replaceIn` a few more are added, namely:

* `prepend()` and `prependTo(target)`
* `insertBefore(target)` and `insertAfter(target)`
* `replaceWith(target)`

A new general method `insertView(callback)` is added. This method takes a callback function which is invoked when the view shall be added to DOM. It's the callbacks responsibility to actually add the view, for example via

```javascript
view.insertView(function(){
Ember.$('.header-placeholder').remove();
this.$().appendTo('.header');
});
```

`insertView(callback)` allows to add the view and implement more setup like removing previous placeholder element or so ...

I open this Pull Request for discussion. Especially about the tests. I don't know if the actual way of testing the stuff is sufficient enough. So please comment and add your 2 cents.

BTW, this addresses #587 and #574