|
|
@ -8,6 +8,7 @@ var QualitySortableCollectionView = require('./QualitySortableCollectionView');
|
|
|
|
var EditProfileView = require('./EditProfileView');
|
|
|
|
var EditProfileView = require('./EditProfileView');
|
|
|
|
var DeleteView = require('../DeleteProfileView');
|
|
|
|
var DeleteView = require('../DeleteProfileView');
|
|
|
|
var FullMovieCollection = require('../../../Movies/FullMovieCollection');
|
|
|
|
var FullMovieCollection = require('../../../Movies/FullMovieCollection');
|
|
|
|
|
|
|
|
var NetImportCollection = require('../../NetImport/NetImportCollection');
|
|
|
|
var Config = require('../../../Config');
|
|
|
|
var Config = require('../../../Config');
|
|
|
|
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
|
|
|
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +29,10 @@ var view = Marionette.Layout.extend({
|
|
|
|
initialize : function(options) {
|
|
|
|
initialize : function(options) {
|
|
|
|
this.profileCollection = options.profileCollection;
|
|
|
|
this.profileCollection = options.profileCollection;
|
|
|
|
this.itemsCollection = new Backbone.Collection(_.toArray(this.model.get('items')).reverse());
|
|
|
|
this.itemsCollection = new Backbone.Collection(_.toArray(this.model.get('items')).reverse());
|
|
|
|
|
|
|
|
this.netImportCollection = new NetImportCollection;
|
|
|
|
|
|
|
|
this.netImportCollection.fetch();
|
|
|
|
this.listenTo(FullMovieCollection, 'all', this._updateDisableStatus);
|
|
|
|
this.listenTo(FullMovieCollection, 'all', this._updateDisableStatus);
|
|
|
|
|
|
|
|
this.listenTo(this.netImportCollection, 'all', this._updateDisableStatus);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
onRender : function() {
|
|
|
|
onRender : function() {
|
|
|
@ -102,9 +106,10 @@ var view = Marionette.Layout.extend({
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
_updateDisableStatus : function() {
|
|
|
|
_updateDisableStatus : function() {
|
|
|
|
if (this._isQualityInUse()) {
|
|
|
|
if (this._isQualityInUse() || this._isQualityInUsebyList()) {
|
|
|
|
|
|
|
|
this.ui.deleteButton.attr('disabled', 'disabled');
|
|
|
|
this.ui.deleteButton.addClass('disabled');
|
|
|
|
this.ui.deleteButton.addClass('disabled');
|
|
|
|
this.ui.deleteButton.attr('title', 'Can\'t delete a profile that is attached to a movie.');
|
|
|
|
this.ui.deleteButton.attr('title', 'Can\'t delete a profile that is attached to a movie or list.');
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.ui.deleteButton.removeClass('disabled');
|
|
|
|
this.ui.deleteButton.removeClass('disabled');
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -112,6 +117,10 @@ var view = Marionette.Layout.extend({
|
|
|
|
|
|
|
|
|
|
|
|
_isQualityInUse : function() {
|
|
|
|
_isQualityInUse : function() {
|
|
|
|
return FullMovieCollection.where({ 'profileId' : this.model.id }).length !== 0;
|
|
|
|
return FullMovieCollection.where({ 'profileId' : this.model.id }).length !== 0;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_isQualityInUsebyList : function() {
|
|
|
|
|
|
|
|
return this.netImportCollection.where({ 'profileId' : this.model.id }).length !== 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
module.exports = AsEditModalView.call(view);
|
|
|
|
module.exports = AsEditModalView.call(view);
|
|
|
|