mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 17:13:49 -07:00
New: Manual Import episodes
This commit is contained in:
parent
29ca1bc9da
commit
6dd22e7dcb
66 changed files with 1766 additions and 117 deletions
92
src/UI/ManualImport/Series/SelectSeriesLayout.js
Normal file
92
src/UI/ManualImport/Series/SelectSeriesLayout.js
Normal file
|
@ -0,0 +1,92 @@
|
|||
var _ = require('underscore');
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var Backgrid = require('backgrid');
|
||||
var SeriesCollection = require('../../Series/SeriesCollection');
|
||||
var SelectRow = require('./SelectSeriesRow');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'ManualImport/Series/SelectSeriesLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
series : '.x-series'
|
||||
},
|
||||
|
||||
ui : {
|
||||
filter : '.x-filter'
|
||||
},
|
||||
|
||||
columns : [
|
||||
{
|
||||
name : 'title',
|
||||
label : 'Title',
|
||||
cell : 'String',
|
||||
sortValue : 'sortTitle'
|
||||
}
|
||||
],
|
||||
|
||||
initialize : function() {
|
||||
var self = this;
|
||||
|
||||
this.seriesCollection = SeriesCollection.clone();
|
||||
|
||||
_.each(this.seriesCollection.models, function (model) {
|
||||
model.collection = self.seriesCollection;
|
||||
});
|
||||
|
||||
this.listenTo(this.seriesCollection, 'row:selected', this._onSelected);
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this.seriesView = new Backgrid.Grid({
|
||||
columns : this.columns,
|
||||
collection : this.seriesCollection,
|
||||
className : 'table table-hover season-grid',
|
||||
row : SelectRow
|
||||
});
|
||||
|
||||
this.series.show(this.seriesView);
|
||||
this._setupFilter();
|
||||
},
|
||||
|
||||
_setupFilter : function () {
|
||||
var self = this;
|
||||
|
||||
//TODO: This should be a mixin (same as Add Series searching)
|
||||
this.ui.filter.keyup(function(e) {
|
||||
if (_.contains([
|
||||
9,
|
||||
16,
|
||||
17,
|
||||
18,
|
||||
19,
|
||||
20,
|
||||
33,
|
||||
34,
|
||||
35,
|
||||
36,
|
||||
37,
|
||||
38,
|
||||
39,
|
||||
40,
|
||||
91,
|
||||
92,
|
||||
93
|
||||
], e.keyCode)) {
|
||||
return;
|
||||
}
|
||||
|
||||
self._filter(self.ui.filter.val());
|
||||
});
|
||||
},
|
||||
|
||||
_filter : function (term) {
|
||||
this.seriesCollection.setFilter(['title', term, 'contains']);
|
||||
},
|
||||
|
||||
_onSelected : function (e) {
|
||||
this.trigger('manualimport:selected:series', { model: e.model });
|
||||
|
||||
vent.trigger(vent.Commands.CloseModal2Command);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue