Created
November 30, 2012 23:30
-
-
Save MichaelSitter/4179464 to your computer and use it in GitHub Desktop.
IIFE class declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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