Skip to content

Instantly share code, notes, and snippets.

@MichaelSitter
Created November 30, 2012 23:30
Show Gist options
  • Save MichaelSitter/4179464 to your computer and use it in GitHub Desktop.
Save MichaelSitter/4179464 to your computer and use it in GitHub Desktop.
IIFE class declaration
(function (curator, backbone, _) {
var view = backbone.Marionette.ItemView.extend({
template: curator.Constants.Templates.FeedProductsGridTableRow,
tagName: 'tr',
attributes: function () {
return {
'data-id': this.model.get('Id')
};
},
serializeData: function () {
var model = this.model,
data = {
Classification : model.get('Classification'),
FeedGrouping : '',
ProductName : '',
MSRP : '',
Manufacturer : '',
Tags : ''
},
fields = this.model.get('Fields');
_.each(fields, function (field) {
var name = field.Definition.LanguageInvariantName.replace(' ', '');
if (data[name] !== undefined) {
data[name] = field.Value;
}
});
return data;
}
});
curator.FeedProductsGridTableRowView = view;
}(window.Curator, window.Backbone, window._));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment