emberjs/ember.js — pull request #2409 by zaius (2013-04-06 00:49:03+00:00)
Title: Allow render template name to be a reference.

This is a very incomplete pull request, but I wanted to see whether this idea was sensible before I fleshed out the docs / tests.

I love the render helper. It's great for creating reusable components, especially when working with routerless applications. I want `render` to be able to look up the template / controller name from a variable, like I can with the `view` helper. This will let me replace my reusable view components with a view / controller pair.

Here's a contrived example of how I am currently using it:

```javascript
App.inputs = [
Ember.Object.create({ label: 'name', renderTemplate: 'textfield' }),
Ember.Object.create({ label: 'email', renderTemplate: 'textfield' }),
Ember.Object.create({ label: 'name', renderTemplate: 'hideable' })
];
```

```
# application.js.handlebars
{{#each input in App.inputs}}
{{render input.renderTemplate input}}
{{/each}}

# textfield.js.handlebars
{{label}}
{{view Ember.TextField}}

# hideable.js.handlebars
I want to enter a value for {{name}}
{{#if visible}} {{view Ember.TextField}} {{/if}}
```

This is my first contribution to ember, and I'm still trying to work my way around the code base, so please let me know if this is completely on the wrong track.

david