mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-20 21:16:56 +00:00
Toggle episode monitored status from episode details
This commit is contained in:
parent
44950c212e
commit
17ffdbc89e
4 changed files with 53 additions and 14 deletions
|
@ -16,21 +16,24 @@ define(
|
||||||
},
|
},
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
summary : '.x-episode-summary',
|
summary : '.x-episode-summary',
|
||||||
activity: '.x-episode-activity',
|
activity : '.x-episode-activity',
|
||||||
search : '.x-episode-search'
|
search : '.x-episode-search',
|
||||||
|
monitored: '.x-episode-monitored'
|
||||||
},
|
},
|
||||||
|
|
||||||
events: {
|
events: {
|
||||||
|
|
||||||
'click .x-episode-summary' : '_showSummary',
|
'click .x-episode-summary' : '_showSummary',
|
||||||
'click .x-episode-activity': '_showActivity',
|
'click .x-episode-activity' : '_showActivity',
|
||||||
'click .x-episode-search' : '_showSearch'
|
'click .x-episode-search' : '_showSearch',
|
||||||
|
'click .x-episode-monitored': '_toggleMonitored'
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
this._showSummary();
|
this._showSummary();
|
||||||
this.searchLayout = new SearchLayout({ model: this.model });
|
this.searchLayout = new SearchLayout({ model: this.model });
|
||||||
|
this._setMonitoredState();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,6 +62,35 @@ define(
|
||||||
|
|
||||||
this.ui.search.tab('show');
|
this.ui.search.tab('show');
|
||||||
this.search.show(this.searchLayout);
|
this.search.show(this.searchLayout);
|
||||||
|
},
|
||||||
|
|
||||||
|
_toggleMonitored: function () {
|
||||||
|
var self = this;
|
||||||
|
var name = 'monitored';
|
||||||
|
this.model.set(name, !this.model.get(name), { silent: true });
|
||||||
|
|
||||||
|
this.ui.monitored.addClass('icon-spinner icon-spin');
|
||||||
|
|
||||||
|
var promise = this.model.save();
|
||||||
|
|
||||||
|
promise.always(function () {
|
||||||
|
self._setMonitoredState();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
_setMonitoredState: function () {
|
||||||
|
var monitored = this.model.get('monitored');
|
||||||
|
|
||||||
|
this.ui.monitored.removeClass('icon-spin icon-spinner');
|
||||||
|
|
||||||
|
if (this.model.get('monitored')) {
|
||||||
|
this.ui.monitored.addClass('icon-bookmark');
|
||||||
|
this.ui.monitored.removeClass('icon-bookmark-empty');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.ui.monitored.addClass('icon-bookmark-empty');
|
||||||
|
this.ui.monitored.removeClass('icon-bookmark');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,11 +2,16 @@
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
|
||||||
{{#if episodeTitle}}
|
<h3>
|
||||||
<h3>{{episodeTitle}} - {{EpisodeNumber}}</h3>
|
<i class="icon-bookmark x-episode-monitored" title="Toggle monitored status" />
|
||||||
{{else}}
|
{{#if episodeTitle}}
|
||||||
<h3>{{title}} - {{EpisodeNumber}}</h3>
|
{{episodeTitle}}
|
||||||
{{/if}}
|
{{else}}
|
||||||
|
{{title}}
|
||||||
|
{{/if}}
|
||||||
|
- {{EpisodeNumber}}
|
||||||
|
</h3>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<ul class="nav nav-tabs" id="myTab">
|
<ul class="nav nav-tabs" id="myTab">
|
||||||
|
|
|
@ -72,6 +72,10 @@ define(
|
||||||
_.each(this.episodeCollection.models, function (episode) {
|
_.each(this.episodeCollection.models, function (episode) {
|
||||||
episode.set({ hideSeriesLink: true, series: options.series });
|
episode.set({ hideSeriesLink: true, series: options.series });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.episodeCollection.on('sync', function () {
|
||||||
|
this.render();
|
||||||
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
|
@ -137,8 +141,6 @@ define(
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSeasonMonitoredState: function () {
|
_setSeasonMonitoredState: function () {
|
||||||
var monitored = this.model.get('monitored');
|
|
||||||
|
|
||||||
this.ui.seasonMonitored.removeClass('icon-spinner icon-spin');
|
this.ui.seasonMonitored.removeClass('icon-spinner icon-spin');
|
||||||
|
|
||||||
if (this.model.get('monitored')) {
|
if (this.model.get('monitored')) {
|
||||||
|
|
|
@ -103,7 +103,7 @@ define(
|
||||||
_setMonitoredState: function () {
|
_setMonitoredState: function () {
|
||||||
var monitored = this.model.get('monitored');
|
var monitored = this.model.get('monitored');
|
||||||
|
|
||||||
this.ui.monitored.removeClass('icon-spin');
|
this.ui.monitored.removeClass('icon-spin icon-spinner');
|
||||||
|
|
||||||
if (this.model.get('monitored')) {
|
if (this.model.get('monitored')) {
|
||||||
this.ui.monitored.addClass('icon-bookmark');
|
this.ui.monitored.addClass('icon-bookmark');
|
||||||
|
|
Loading…
Reference in a new issue