mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Added seasons to top of series details (toggling and jump to)
This commit is contained in:
parent
49c5762c6d
commit
125deb3931
9 changed files with 176 additions and 5 deletions
88
UI/Series/Details/SeasonMenu/ItemView.js
Normal file
88
UI/Series/Details/SeasonMenu/ItemView.js
Normal file
|
@ -0,0 +1,88 @@
|
|||
'use strict';
|
||||
define(
|
||||
[
|
||||
'marionette',
|
||||
'Shared/Actioneer'
|
||||
], function (Marionette, Actioneer) {
|
||||
return Marionette.ItemView.extend({
|
||||
template: 'Series/Details/SeasonMenu/ItemViewTemplate',
|
||||
tagName : 'span',
|
||||
|
||||
ui: {
|
||||
seasonMonitored: '.x-season-monitored'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-season-monitored': '_seasonMonitored',
|
||||
'click .x-text': '_gotoSeason'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
|
||||
if (!options.episodeCollection) {
|
||||
throw 'episodeCollection is needed';
|
||||
}
|
||||
|
||||
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
|
||||
|
||||
var allDownloaded = _.all(this.episodeCollection.models, function (model) {
|
||||
var hasFile = model.get('hasFile');
|
||||
return hasFile;
|
||||
});
|
||||
|
||||
this.model.set({
|
||||
allFilesDownloaded: allDownloaded
|
||||
});
|
||||
|
||||
this.model.on('sync', function () {
|
||||
this.render();
|
||||
}, this);
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this._setSeasonMonitoredState();
|
||||
},
|
||||
|
||||
_seasonSearch: function () {
|
||||
Actioneer.ExecuteCommand({
|
||||
command : 'seasonSearch',
|
||||
properties : {
|
||||
seriesId : this.model.get('seriesId'),
|
||||
seasonNumber: this.model.get('seasonNumber')
|
||||
},
|
||||
element : this.ui.seasonSearch,
|
||||
failMessage : 'Search for season {0} failed'.format(this.model.get('seasonNumber')),
|
||||
startMessage: 'Search for season {0} started'.format(this.model.get('seasonNumber'))
|
||||
});
|
||||
},
|
||||
|
||||
_seasonMonitored: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var name = 'monitored';
|
||||
this.model.set(name, !this.model.get(name));
|
||||
|
||||
Actioneer.SaveModel({
|
||||
context : this,
|
||||
element : this.ui.seasonMonitored
|
||||
});
|
||||
},
|
||||
|
||||
_setSeasonMonitoredState: function () {
|
||||
this.ui.seasonMonitored.removeClass('icon-spinner icon-spin');
|
||||
|
||||
if (this.model.get('monitored')) {
|
||||
this.ui.seasonMonitored.addClass('icon-bookmark');
|
||||
this.ui.seasonMonitored.removeClass('icon-bookmark-empty');
|
||||
}
|
||||
else {
|
||||
this.ui.seasonMonitored.addClass('icon-bookmark-empty');
|
||||
this.ui.seasonMonitored.removeClass('icon-bookmark');
|
||||
}
|
||||
},
|
||||
|
||||
_gotoSeason: function () {
|
||||
window.location.hash = '#season-' + this.model.get('seasonNumber');
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue