Skip to content

Instantly share code, notes, and snippets.

@alexspeller
Last active December 18, 2015 07:09
Show Gist options
  • Save alexspeller/5744563 to your computer and use it in GitHub Desktop.
Save alexspeller/5744563 to your computer and use it in GitHub Desktop.
// This is the presenter class that stores the state
App.FooPresenter = Em.ObjectProxy.create({
textAreaContent: '',
isExpanded: false
});
// This is your controller - be sure to set the content to a list of models in your route
App.FoosController = Em.ArrayController.extend({
presenters: function() {
return this.get('content').map(function(foo){
return App.FooPresenter.create({content: foo});
});
}.property('content.@each')
});
// This is your template
{{#each presenters}}
name: {{name}}
{{#if isExpanded}}
<textarea>
{{textAreaContent}}
</textarea>
{{/if}}
{{/each}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment