rootfolder is linked to add series.

pull/3113/head
kay.one 12 years ago
parent bf50c5989a
commit 1024e0f83d

@ -182,6 +182,7 @@
<ItemGroup>
<Compile Include="App_Start\DataTablesMvc.cs" />
<Compile Include="App_Start\MiniProfiler.cs" />
<Content Include="_backboneApp\AddSeries\AddNewSeries\SearchResultView.js" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirView.js" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirItemTemplate.html" />
@ -396,7 +397,7 @@
<Content Include="_backboneApp\JsLibraries\handlebars.js" />
<Content Include="_backboneApp\JsLibraries\jquery.js" />
<Content Include="_backboneApp\JsLibraries\jquery-ui-1.9.0.js" />
<Content Include="_backboneApp\JsLibraries\marionette.viewswapper.js" />
<Content Include="_backboneApp\JsLibraries\backbone.marionette.viewswapper.js" />
<Content Include="_backboneApp\JsLibraries\sugar.js" />
<Content Include="_backboneApp\JsLibraries\underscore.js" />
<Content Include="Views\System\Index.cshtml" />

@ -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 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);
},
});

@ -28,7 +28,7 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
$(this).tab('show');
});
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView());
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection }));
//this.importExisting.show(new NzbDrone.ImportExistingView());
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));

@ -8,7 +8,7 @@
}
.nz-input-large *[class*='icon-'] {
font-size: 30px;
font-size: 28px;
height: 30px;
width: 40px;
padding-top: 14px;
@ -23,20 +23,29 @@
.result-list .well:hover {
background-color: #fcf8e3;
cursor: pointer;
}
.result-item {
padding-left: 20px;
}
.result-item *[class*='icon-'] {
padding-right: 10px;
.search-item .accordion-heading *[class*='icon-'] {
padding-right: 5px;
padding-top: 10px;
padding-left: 10px;
}
.result-list .result-item a {
font-size: 20px;
}
.result-list .result-item a:hover {
text-decoration: none;
}
.search-item a:hover {
text-decoration: none;
}
.search-item a {
color: #343434;
}
.search-item select {
font-size: 16px;
}

@ -1,4 +1,6 @@
_.extend(Marionette.TemplateCache.prototype, {
/// <reference path="handlebars.js" />
_.extend(Marionette.TemplateCache.prototype, {
loadTemplate: function (templateId) {
@ -24,9 +26,9 @@
}
});
_.extend(Marionette.TemplateCache.prototype, {
_.extend(Marionette.View.prototype, {
compileTemplate: function (rawTemplate) {
return Handlebars.compile(rawTemplate);
}
});

@ -47,22 +47,20 @@ window.onerror = function (msg, url, line) {
}
var suppressErrorAlert = false;
// If you return true, then error alerts (like in older versions of
// Internet Explorer) will be suppressed.
return suppressErrorAlert;
};
$(document).ajaxError(function (event, XMLHttpRequest, ajaxOptionsa) {
$(document).ajaxError(function (event, xmlHttpRequest, ajaxOptions) {
if (xmlHttpRequest.status >= 200 && xmlHttpRequest.status <= 300) return;
var errorView = NzbDrone.Shared.ErrorView.instance;
var model = new NzbDrone.Shared.ErrorModel();
model.set('title', ajaxOptionsa.url + " : " + XMLHttpRequest.statusText);
model.set('message', XMLHttpRequest.responseText);
model.set('title', ajaxOptions.url + " : " + xmlHttpRequest.statusText);
model.set('message', xmlHttpRequest.responseText);
errorView.collection.add(model);
var suppressErrorAlert = false;
// If you return true, then error alerts (like in older versions of
// Internet Explorer) will be suppressed.
return suppressErrorAlert;
});

@ -8,6 +8,7 @@
/// <reference path="JsLibraries/backbone.shortcuts.js" />
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
/// <reference path="JsLibraries/backbone.marionette.viewswapper.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/bootstrap.js" />
/// <reference path="nzbdrone.logging.js" />
@ -20,9 +21,11 @@ NzbDrone = new Backbone.Marionette.Application();
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
NzbDrone.Shared = NzbDrone.module("Shared");
/*
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
*/
NzbDrone.ModelBinder = new Backbone.ModelBinder();

Loading…
Cancel
Save