Fixes #128pull/208/head v0.2.0.99
parent
0b70a5c315
commit
5a8d944397
@ -0,0 +1,34 @@
|
||||
var Backgrid = require('backgrid');
|
||||
var ProfileCollection = require('../Profile/ProfileCollection');
|
||||
var _ = require('underscore');
|
||||
|
||||
module.exports = Backgrid.Cell.extend({
|
||||
className : 'profile-cell',
|
||||
|
||||
_originalInit : Backgrid.Cell.prototype.initialize,
|
||||
|
||||
initialize : function () {
|
||||
this._originalInit.apply(this, arguments);
|
||||
|
||||
this.listenTo(ProfileCollection, 'sync', this.render);
|
||||
},
|
||||
|
||||
render : function() {
|
||||
|
||||
this.$el.empty();
|
||||
if (this.model.get("movieFile")) {
|
||||
var profileId = this.model.get("movieFile").quality.quality.id;
|
||||
|
||||
var profile = _.findWhere(ProfileCollection.models, { id : profileId });
|
||||
|
||||
if (profile) {
|
||||
this.$el.html(profile.get('name'));
|
||||
} else {
|
||||
this.$el.html(this.model.get("movieFile").quality.quality.name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
Loading…
Reference in new issue