Skip to content

Instantly share code, notes, and snippets.

@tristen
Created April 23, 2011 15:59
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 tristen/938729 to your computer and use it in GitHub Desktop.
Save tristen/938729 to your computer and use it in GitHub Desktop.
view = Backbone.View.extend({
initialize: function(options) {
_.bindAll(this, 'render');
this.render();
this.trigger('attach');
},
render: function() {
var groups = {};
for (var k in this.model.schema) {
groups[k] = {
group: this.model.schema[k].group || 'No Group (yet)',
title: this.model.schema[k].title,
value: this.model.attributes[k] || '<span>No Data</span>'
};
}
console.log(groups);
$(this.el).html(templates.Product({
product: this.model.attributes,
institution: this.options.institutionModel.attributes,
groups: groups
}));
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment