|
|
|
@ -7,7 +7,7 @@ var EditProfileItemView = require('./EditProfileItemView');
|
|
|
|
|
var QualitySortableCollectionView = require('./QualitySortableCollectionView');
|
|
|
|
|
var EditProfileView = require('./EditProfileView');
|
|
|
|
|
var DeleteView = require('../DeleteProfileView');
|
|
|
|
|
var SeriesCollection = require('../../../Series/SeriesCollection');
|
|
|
|
|
var FullMovieCollection = require('../../../Movies/FullMovieCollection');
|
|
|
|
|
var Config = require('../../../Config');
|
|
|
|
|
var AsEditModalView = require('../../../Mixins/AsEditModalView');
|
|
|
|
|
|
|
|
|
@ -28,7 +28,7 @@ var view = Marionette.Layout.extend({
|
|
|
|
|
initialize : function(options) {
|
|
|
|
|
this.profileCollection = options.profileCollection;
|
|
|
|
|
this.itemsCollection = new Backbone.Collection(_.toArray(this.model.get('items')).reverse());
|
|
|
|
|
this.listenTo(SeriesCollection, 'all', this._updateDisableStatus);
|
|
|
|
|
this.listenTo(FullMovieCollection, 'all', this._updateDisableStatus);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRender : function() {
|
|
|
|
@ -104,14 +104,14 @@ var view = Marionette.Layout.extend({
|
|
|
|
|
_updateDisableStatus : function() {
|
|
|
|
|
if (this._isQualityInUse()) {
|
|
|
|
|
this.ui.deleteButton.addClass('disabled');
|
|
|
|
|
this.ui.deleteButton.attr('title', 'Can\'t delete a profile that is attached to a series.');
|
|
|
|
|
this.ui.deleteButton.attr('title', 'Can\'t delete a profile that is attached to a movie.');
|
|
|
|
|
} else {
|
|
|
|
|
this.ui.deleteButton.removeClass('disabled');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_isQualityInUse : function() {
|
|
|
|
|
return SeriesCollection.where({ 'profileId' : this.model.id }).length !== 0;
|
|
|
|
|
return FullMovieCollection.where({ 'profileId' : this.model.id }).length !== 0;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
module.exports = AsEditModalView.call(view);
|
|
|
|
|