Skip to content

Instantly share code, notes, and snippets.

@gordonbrander
Created May 9, 2012 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gordonbrander/2646337 to your computer and use it in GitHub Desktop.
Save gordonbrander/2646337 to your computer and use it in GitHub Desktop.
Potential Kicks Controller/View API
var postModels = new Models();
postModels.fetch();
postModels.on('change', function (postModels) {
$('.post').models(postModels)
.render(function (model) {
$(this)
.find('.meta .author').html(model.prop('meta.author')).end()
.find('.title').html(model.prop('title')).end();
})
.enter()
.render(myMustacheTemplate)
.on('click', '.title', function (e) {
this.logHit().orWhatever();
return this;
})
.end()
.exit()
.render(function () {
return $(node).fadeOut().remove();
})
.end();
return postModels;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment