You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/UI/ManualImport/Cells/SeasonCell.js

47 lines
1.1 KiB

var vent = require('../../vent');
var NzbDroneCell = require('../../Cells/NzbDroneCell');
var SelectSeasonLayout = require('../Season/SelectSeasonLayout');
module.exports = NzbDroneCell.extend({
className : 'season-cell editable',
events : {
'click' : '_onClick'
},
render : function() {
this.$el.empty();
if (this.model.has('seasonNumber')) {
this.$el.html(this.model.get('seasonNumber'));
}
this.delegateEvents();
return this;
},
_onClick : function () {
var series = this.model.get('series');
if (!series) {
return;
}
var view = new SelectSeasonLayout({ seasons: series.seasons });
this.listenTo(view, 'manualimport:selected:season', this._setSeason);
vent.trigger(vent.Commands.OpenModal2Command, view);
},
_setSeason : function (e) {
if (this.model.has('seasonNumber') && e.seasonNumber === this.model.get('seasonNumber')) {
return;
}
this.model.set({
seasonNumber : e.seasonNumber,
episodes : []
});
}
});