Skip to content

Instantly share code, notes, and snippets.

@scottharvey
Created March 29, 2011 01:24
Show Gist options
  • Save scottharvey/891661 to your computer and use it in GitHub Desktop.
Save scottharvey/891661 to your computer and use it in GitHub Desktop.
render: function() {
// Initialize the template
if (this.template == null) { this.template = Haml($('#task_template').html()); }
// Update the template based on the model's attributes
$(this.el).html(this.template(this.model.viewAttributes()));
// Insert the template into the DOM if it doesn't already exist
if ($('#' + this.id).length == 0) {
$(this.model.milestone.view.el).after(this.el);
}
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment