Toggle monitored status from season pass as well as all seasons (skip specials)

pull/2/head
Mark McDowall 11 years ago
parent 154a6b39be
commit f32cbbb224

@ -2,6 +2,7 @@
define(
[
'app',
'underscore',
'marionette',
'Quality/QualityProfileCollection',
'AddSeries/RootFolders/Collection',
@ -11,7 +12,7 @@ define(
'Shared/Messenger',
'Mixins/AsValidatedView',
'jquery.dotdotdot'
], function (App, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger, AsValidatedView) {
], function (App, _, Marionette, QualityProfiles, RootFolders, RootFolderLayout, SeriesCollection, Config, Messenger, AsValidatedView) {
var view = Marionette.ItemView.extend({

@ -15,7 +15,7 @@ define(
'Logs/Files/Layout',
'Release/Layout',
'System/Layout',
'SeasonPass/Layout',
'SeasonPass/SeasonPassLayout',
'Shared/NotFoundView',
'Shared/Modal/Region'
], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, SeriesCollection, MissingLayout, CalendarLayout,

@ -13,7 +13,7 @@
var filename = a.pathname.split('/').pop();
//Suppress Firefox debug errors when console window is closed
if (filename.toLowerCase() === 'markupview.jsm') {
if (filename.toLowerCase() === 'markupview.jsm' || filename.toLowerCase() === 'markup-view.js') {
return false;
}

@ -12,7 +12,7 @@ define(
SeriesCollectionView,
LoadingView) {
return Marionette.Layout.extend({
template: 'SeasonPass/LayoutTemplate',
template: 'SeasonPass/SeasonPassLayoutTemplate',
regions: {
series: '#x-series'

@ -1,24 +1,28 @@
'use strict';
define(
[
'underscore',
'marionette',
'backgrid',
'Series/SeasonCollection'
], function (Marionette, Backgrid, SeasonCollection) {
], function (_, Marionette, Backgrid, SeasonCollection) {
return Marionette.Layout.extend({
template: 'SeasonPass/SeriesLayoutTemplate',
ui: {
seasonSelect: '.x-season-select',
expander : '.x-expander',
seasonGrid : '.x-season-grid'
seasonSelect : '.x-season-select',
expander : '.x-expander',
seasonGrid : '.x-season-grid',
seriesMonitored: '.x-series-monitored'
},
events: {
'change .x-season-select': '_seasonSelected',
'click .x-expander' : '_expand',
'click .x-latest' : '_latest',
'click .x-monitored' : '_toggleSeasonMonitored'
'change .x-season-select' : '_seasonSelected',
'click .x-expander' : '_expand',
'click .x-latest' : '_latest',
'click .x-all' : '_all',
'click .x-monitored' : '_toggleSeasonMonitored',
'click .x-series-monitored': '_toggleSeriesMonitored'
},
regions: {
@ -26,6 +30,7 @@ define(
},
initialize: function () {
this.listenTo(this.model, 'sync', this._setSeriesMonitoredState);
this.seasonCollection = new SeasonCollection(this.model.get('seasons'));
this.expanded = false;
},
@ -36,16 +41,17 @@ define(
}
this._setExpanderIcon();
this._setSeriesMonitoredState();
},
_seasonSelected: function () {
var seasonNumber = parseInt(this.ui.seasonSelect.val());
if (seasonNumber == -1 || isNaN(seasonNumber)) {
if (seasonNumber === -1 || isNaN(seasonNumber)) {
return;
}
this._setMonitored(seasonNumber)
this._setSeasonMonitored(seasonNumber);
},
_expand: function () {
@ -79,10 +85,16 @@ define(
return s.seasonNumber;
});
this._setMonitored(season.seasonNumber);
this._setSeasonMonitored(season.seasonNumber);
},
_setMonitored: function (seasonNumber) {
_all: function () {
var minSeasonNotZero = _.min(_.reject(this.model.get('seasons'), { seasonNumber: 0 }), 'seasonNumber');
this._setSeasonMonitored(minSeasonNotZero.seasonNumber);
},
_setSeasonMonitored: function (seasonNumber) {
var self = this;
this.model.setSeasonPass(seasonNumber);
@ -118,6 +130,29 @@ define(
_afterToggleSeasonMonitored: function () {
this.render();
},
_setSeriesMonitoredState: function () {
var monitored = this.model.get('monitored');
this.ui.seriesMonitored.removeAttr('data-idle-icon');
if (monitored) {
this.ui.seriesMonitored.addClass('icon-nd-monitored');
this.ui.seriesMonitored.removeClass('icon-nd-unmonitored');
}
else {
this.ui.seriesMonitored.addClass('icon-nd-unmonitored');
this.ui.seriesMonitored.removeClass('icon-nd-monitored');
}
},
_toggleSeriesMonitored: function (e) {
var savePromise = this.model.save('monitored', !this.model.get('monitored'), {
wait: true
});
this.ui.seriesMonitored.spinForPromise(savePromise);
}
});
});

@ -1,8 +1,8 @@
<div class="seasonpass-series">
<div class="row">
<div class="span11">
<div class="span12">
<i class="icon-chevron-right x-expander expander pull-left"/>
<i class="x-series-monitored series-monitor-toggle pull-left" title="Toggle monitored state for entire series"/>
<span class="title span5">
<a href="{{route}}">
{{title}}
@ -26,10 +26,20 @@
</span>
</span>
<button class="btn x-latest">Latest</button>
<span class="season-pass-button">
<button class="btn x-latest">Latest</button>
<span class="help-inline">
<i class="icon-question-sign" title="Will quickly select the latest season as first monitored"/>
<span class="help-inline">
<i class="icon-question-sign" title="Will quickly select the latest season as first monitored"/>
</span>
</span>
<span class="season-pass-button">
<button class="btn x-all">All</button>
<span class="help-inline">
<i class="icon-question-sign" title="Will quickly select all seasons except for specials to be monitored"/>
</span>
</span>
</div>
</div>

@ -2,7 +2,7 @@
<div class="span11">
<div class="row">
<h1>
<i class="x-monitored clickable series-monitor-toggle" title="Toggle monitored state for entire series"/>
<i class="x-monitored" title="Toggle monitored state for entire series"/>
{{title}}
<div class="series-actions pull-right">
<div class="x-refresh">

@ -274,3 +274,16 @@
font-size : 16px;
vertical-align : middle !important;
}
.seasonpass-series {
.season-pass-button {
display: inline-block;
width: 120px;
}
.series-monitor-toggle {
font-size: 24px;
margin-top: 3px;
}
}
Loading…
Cancel
Save