mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-22 22:34:53 -04:00
rootfolder is linked to add series.
This commit is contained in:
@@ -1,26 +1,5 @@
|
||||
/// <reference path="../../app.js" />
|
||||
/// <reference path="../SearchResultModel.js" />
|
||||
/// <reference path="../SearchResultCollection.js" />
|
||||
|
||||
NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: "AddSeries/AddNewSeries/SearchResultTemplate",
|
||||
className: 'search-item-view well',
|
||||
onRender: function () {
|
||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.AddSeries.SearchItemView,
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.collection, 'reset', this.render);
|
||||
},
|
||||
|
||||
});
|
||||
/// <reference path="SearchResultView.js" />
|
||||
|
||||
NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
template: "AddSeries/AddNewSeries/AddNewSeriesTemplate",
|
||||
@@ -36,6 +15,13 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
|
||||
collection: new NzbDrone.AddSeries.SearchResultCollection(),
|
||||
|
||||
initialize: function (rootFolders) {
|
||||
if (rootFolders === undefined) {
|
||||
throw "rootFolder arg is required.";
|
||||
}
|
||||
|
||||
this.rootFoldersCollection = rootFolders;
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
console.log('binding auto complete');
|
||||
@@ -62,13 +48,22 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
|
||||
context.collection.fetch({
|
||||
data: $.param({ term: term }),
|
||||
success: function () {
|
||||
context.searchResult.show(context.resultView);
|
||||
success: function (model) {
|
||||
context.resultUpdated(model, context);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
context.searchResult.close();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
resultUpdated: function (options, context) {
|
||||
_.each(options.models, function (model) {
|
||||
model.set('rootFolders', context.rootFoldersCollection.rootFolders.models);
|
||||
});
|
||||
|
||||
context.searchResult.show(context.resultView);
|
||||
}
|
||||
});
|
||||
@@ -1,5 +1,22 @@
|
||||
<div class="result-item row">
|
||||
<div>
|
||||
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign"></a>{{seriesName}} {{seriesYear}}
|
||||
</div>
|
||||
<div class="accordion-heading">
|
||||
<a href="http://thetvdb.com/?tab=series&id={{id}}" target="_blank" class="icon-info-sign pull-left"></a>
|
||||
<a class="accordion-toggle" data-toggle="collapse" href="#{{id}}">{{seriesName}} {{seriesYear}}</a>
|
||||
</div>
|
||||
<div id="{{id}}" class="accordion-body collapse">
|
||||
<div class="accordion-inner">
|
||||
<select class="root-dir-input span7" name="rootFolders">
|
||||
{{#each rootFolders}}
|
||||
<option value="{{id}}">{{attributes.path}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
<select class="quality-profile-input span2">
|
||||
<option value="volvo">Volvo</option>
|
||||
<option value="saab">Saab</option>
|
||||
<option value="mercedes">Mercedes</option>
|
||||
<option value="audi">Audi</option>
|
||||
</select>
|
||||
<div class="btn btn-success pull-right icon-plus">
|
||||
</div>
|
||||
</div>
|
||||
<div name="overview"></div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../../app.js" />
|
||||
/// <reference path="../SearchResultModel.js" />
|
||||
/// <reference path="../SearchResultCollection.js" />
|
||||
|
||||
NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: "AddSeries/AddNewSeries/SearchResultTemplate",
|
||||
className: 'search-item accordion-group',
|
||||
onRender: function () {
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
|
||||
|
||||
itemView: NzbDrone.AddSeries.SearchItemView,
|
||||
|
||||
className: 'accordion',
|
||||
|
||||
initialize: function () {
|
||||
this.listenTo(this.collection, 'reset', this.render);
|
||||
},
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user