2013-02-09 10:04:18 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
/*global NzbDrone, Backbone*/
|
|
|
|
|
/// <reference path="../../app.js" />
|
|
|
|
|
/// <reference path="../SeriesModel.js" />
|
|
|
|
|
/// <reference path="../SeriesCollection.js" />
|
2013-02-10 10:28:56 +00:00
|
|
|
|
/// <reference path="../EditSeriesView.js" />
|
2013-02-10 03:42:44 +00:00
|
|
|
|
/// <reference path="../DeleteSeriesView.js" />
|
2013-02-10 10:28:56 +00:00
|
|
|
|
/// <reference path="../../Quality/qualityProfileCollection.js" />
|
2013-02-09 10:04:18 +00:00
|
|
|
|
|
|
|
|
|
NzbDrone.Series.Index.SeriesItemView = Backbone.Marionette.ItemView.extend({
|
|
|
|
|
template: 'Series/Index/SeriesItemTemplate',
|
|
|
|
|
tagName: 'tr',
|
|
|
|
|
|
2013-02-10 03:42:44 +00:00
|
|
|
|
ui: {
|
|
|
|
|
'progressbar': '.progress .bar',
|
|
|
|
|
},
|
|
|
|
|
|
2013-02-09 10:04:18 +00:00
|
|
|
|
events: {
|
2013-02-10 10:28:56 +00:00
|
|
|
|
'click .x-edit': 'editSeries',
|
|
|
|
|
'click .x-remove': 'removeSeries'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
initialize: function(options) {
|
|
|
|
|
this.qualityProfileCollection = options.qualityProfiles;
|
2013-02-09 10:04:18 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onRender: function () {
|
|
|
|
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
|
|
|
|
},
|
|
|
|
|
|
2013-02-10 10:28:56 +00:00
|
|
|
|
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
2013-02-10 03:42:44 +00:00
|
|
|
|
|
2013-02-10 10:28:56 +00:00
|
|
|
|
editSeries: function () {
|
|
|
|
|
var view = new NzbDrone.Series.EditSeriesView({ model: this.model, qualityProfiles: this.qualityProfileCollection });
|
|
|
|
|
view.on('saved', this.render, this);
|
|
|
|
|
NzbDrone.modalRegion.show(view);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
removeSeries: function () {
|
2013-02-10 03:42:44 +00:00
|
|
|
|
var view = new NzbDrone.Series.DeleteSeriesView({ model: this.model });
|
|
|
|
|
NzbDrone.modalRegion.show(view);
|
2013-02-09 10:04:18 +00:00
|
|
|
|
},
|
2013-02-10 10:28:56 +00:00
|
|
|
|
onSave: function() {
|
|
|
|
|
alert("saved!");
|
|
|
|
|
}
|
2013-02-09 10:04:18 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
NzbDrone.Series.Index.SeriesCollectionView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
|
itemView: NzbDrone.Series.Index.SeriesItemView,
|
2013-02-10 10:28:56 +00:00
|
|
|
|
itemViewOptions: {},
|
2013-02-09 10:04:18 +00:00
|
|
|
|
template: 'Series/Index/SeriesCollectionTemplate',
|
|
|
|
|
tagName: 'table',
|
|
|
|
|
className: 'table table-hover',
|
2013-02-10 10:28:56 +00:00
|
|
|
|
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
|
|
|
|
|
|
|
|
|
|
initialize: function() {
|
|
|
|
|
this.qualityProfileCollection.fetch();
|
|
|
|
|
this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection };
|
|
|
|
|
}
|
2013-02-09 10:04:18 +00:00
|
|
|
|
});
|