Skip to content

Instantly share code, notes, and snippets.

@sanderpick
Created November 14, 2012 18:21
Show Gist options
  • Save sanderpick/4073812 to your computer and use it in GitHub Desktop.
Save sanderpick/4073812 to your computer and use it in GitHub Desktop.
mol row result view
/*
* Search Result view
*/
define([
// dependencies
'jQuery',
'Underscore',
'views/boiler',
'text!/templates/rows/result.html',
'mps'
], function ($, _, Views, template, mps) {
return Views.RowView.extend({
attributes: function () {
return _.extend({
class: this.model ? 'resultContainer'
+ ' name-' + this.model.get('name').replace(/ /g, '_')
+ ' source_type-' + this.model.get('source_type')
+ ' type-' + this.model.get('type')
: '',
id: this.model.id
}, Views.ListView.prototype.attributes.call(this));
},
initialize: function (params, parent) {
this.template = _.template(template);
Views.RowView.prototype.initialize.call(this, params, parent);
},
render: function () {
Views.RowView.prototype.render.call(this);
return this;
},
events: {
'click .buttonContainer': 'select'
},
setup: function () {
Views.RowView.prototype.setup.call(this);
return this;
},
select: function (e) {
console.log(e)
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment