backbone-generator/templates/view.js.erb

13 lines
339 B
Plaintext
Raw Normal View History

2011-04-15 18:55:37 +00:00
var <%= object_name %>View = Backbone.View.extend({
template: JST['<%= underscore_name %>s/view'],
2011-04-15 18:55:37 +00:00
initialize: function() {
_.bindAll(this, 'render');
},
render: function() {
2011-04-29 19:05:54 +00:00
$(this.el).html(this.template(this.model.toJSON()));
this.$('button').text(this.model.isNew() ? 'Create' : 'Update');
return this;
2011-04-15 18:55:37 +00:00
}
});