1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-25 09:21:57 +00:00

Added latest button to Season Pass

This commit is contained in:
Mark McDowall 2013-08-05 23:17:46 -07:00
parent 63dd1fc189
commit 4cfe57f13d
2 changed files with 50 additions and 24 deletions

View file

@ -18,7 +18,8 @@ define(
events: {
'change .x-season-select': '_seasonSelected',
'click .x-expander' : '_expand'
'click .x-expander' : '_expand',
'click .x-latest' : '_latest'
},
regions: {
@ -66,26 +67,13 @@ define(
},
_seasonSelected: function () {
var self = this;
var seasonNumber = parseInt(this.ui.seasonSelect.val());
if (seasonNumber == -1) {
if (seasonNumber == -1 || isNaN(seasonNumber)) {
return;
}
var promise = $.ajax({
url: this.seasonCollection.url + '/pass',
type: 'POST',
data: {
seriesId: this.model.get('id'),
seasonNumber: seasonNumber
}
});
promise.done(function (data) {
self.seasonCollection = new SeasonCollection(data);
self.render();
});
this._setMonitored(seasonNumber)
},
_expand: function () {
@ -112,6 +100,34 @@ define(
this.ui.expander.removeClass('icon-chevron-down');
this.ui.expander.addClass('icon-chevron-right');
}
},
_latest: function () {
var season = _.max(this.seasonCollection.models, function (model) {
return model.get('seasonNumber');
});
//var seasonNumber = season.get('seasonNumber');
this._setMonitored(season.get('seasonNumber'))
},
_setMonitored: function (seasonNumber) {
var self = this;
var promise = $.ajax({
url: this.seasonCollection.url + '/pass',
type: 'POST',
data: {
seriesId: this.model.get('id'),
seasonNumber: seasonNumber
}
});
promise.done(function (data) {
self.seasonCollection = new SeasonCollection(data);
self.render();
});
}
});
});

View file

@ -8,18 +8,28 @@
{{title}}
</a>
</span>
<select class="x-season-select season-select">
<option value="-1">Select season...</option>
{{#each seasons.models}}
<span class="span3">
<select class="x-season-select season-select">
<option value="-1">Select season...</option>
{{#each seasons.models}}
{{#if_eq attributes.seasonNumber compare="0"}}
<option value="{{attributes.seasonumber}}">Specials</option>
<option value="{{attributes.seasonNumber}}">Specials</option>
{{else}}
<option value="{{attributes.seasonNumber}}">Season {{attributes.seasonNumber}}</option>
<option value="{{attributes.seasonNumber}}">Season {{attributes.seasonNumber}}</option>
{{/if_eq}}
{{/each}}
</select>
{{/each}}
</select>
<span class="help-inline">
<i class="icon-question-sign" title="Selecting a season will unmonitor all previous seasons"/>
</span>
</span>
<button class="btn x-latest">Latest</button>
<span class="help-inline">
<i class="icon-question-sign" title="Selecting a season will unmonitor all previous seasons"/>
<i class="icon-question-sign" title="Will quickly select the latest season as first monitored"/>
</span>
</div>
</div>