Added monitored, edit and refresh to series details

pull/4/head
Mark McDowall 12 years ago
parent 3e7ef408ee
commit bb42bb30aa

@ -88,11 +88,6 @@ namespace NzbDrone.Api.Series
private SeriesResource AddSeries(SeriesResource seriesResource)
{
//Todo: Alert the user if this series already exists
//Todo: We need to create the folder if the user is adding a new series
//(we can just create the folder and it won't blow up if it already exists)
//We also need to remove any special characters from the filename before attempting to create it
return ToResource<Core.Tv.Series>(_seriesService.AddSeries, seriesResource);
}

@ -3,7 +3,7 @@
{{seasonTitle}}
<span class="season-actions pull-right">
<i class="x-season-monitored" title="Toggle season monitored status" />
<i class="icon-search x-season-search" />
<i class="icon-search x-season-search" title="Search for all episodes in season {{seasonNumber}}" />
</span>
</h2>
<div id="x-episode-grid"/>

@ -1,13 +1,16 @@
'use strict';
define(
[
'app',
'marionette',
'Series/EpisodeCollection',
'Series/SeasonCollection',
'Series/Details/SeasonCollectionView',
'Series/Edit/EditSeriesView',
'Shared/LoadingView',
'Commands/CommandController',
'backstrech'
], function (Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, LoadingView) {
], function (App, Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, EditSeriesView, LoadingView, CommandController) {
return Marionette.Layout.extend({
itemViewContainer: '.x-series-seasons',
@ -18,11 +21,24 @@ define(
},
ui: {
header: '.x-header'
header : '.x-header',
monitored: '.x-monitored',
edit : '.x-edit',
refresh : '.x-refresh'
},
events: {
'click .x-monitored': '_toggleMonitored',
'click .x-edit' : '_editSeries',
'click .x-refresh' : '_refreshSeries'
},
initialize: function () {
$('body').addClass('backdrop');
this.model.on('sync', function () {
this._setMonitoredState()
}, this);
},
onShow: function () {
@ -47,11 +63,58 @@ define(
series : self.model
}));
});
this._setMonitoredState();
},
onClose: function () {
$('.backstretch').remove();
$('body').removeClass('backdrop');
},
_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-spinner icon-spin');
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');
}
},
_editSeries: function () {
var view = new EditSeriesView({ model: this.model });
App.modalRegion.show(view);
},
_refreshSeries: function () {
var self = this;
this.ui.refresh.addClass('icon-spinner icon-spin');
var promise = CommandController.Execute('refreshseries', { seriesId: this.model.get('id') });
promise.always(function () {
self.ui.refresh.removeClass('icon-spinner icon-spin');
});
}
});
});

@ -1,7 +1,14 @@
<div class="row series-page-header">
<div class="span11">
<div class="row">
<h1>{{title}}</h1>
<h1>
{{title}}
<span class="series-actions pull-right">
<i class="icon-refresh x-refresh" title="Update Series"/>
<i class="icon-bookmark x-monitored" title="Toggle monitored state for entire series"/>
<i class="icon-nd-edit x-edit" title="Edit series"/>
</span>
</h1>
</div>
<div class="row series-detail-overview">
{{overview}}

@ -183,7 +183,7 @@
}
}
.season-actions {
.season-actions, .series-actions {
font-size : 24px;
text-transform: none;

Loading…
Cancel
Save