Skip to content

Instantly share code, notes, and snippets.

@taai
Last active December 17, 2015 04:18
Show Gist options
  • Save taai/5549022 to your computer and use it in GitHub Desktop.
Save taai/5549022 to your computer and use it in GitHub Desktop.
<script>
Post = can.Model({
}, {
init: function() {
var children = this.children;
this.removeAttr('children');
this.children = new Post.List( children.serialize() );
}
});
</script>
<script type="text/ejs" id="listTeplateEJS">
<ul>
<% posts.each(function(post) { %>
<li <%= (el)-> el.data('post', post) %>>
<span class="title"><%= post.attr('title') %></span>
<ul>
<%== can.view.render('#listTeplateEJS', { posts: post.children }) %>
</ul>
</li>
<% }) %>
</ul>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment