mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
updated add series
This commit is contained in:
@@ -66,8 +66,8 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||
|
||||
resultUpdated: function (options, context) {
|
||||
_.each(options.models, function (model) {
|
||||
model.set('rootFolders', context.rootFoldersCollection.models);
|
||||
model.set('qualityProfiles', context.qualityProfilesCollection.models);
|
||||
model.set('rootFolders', context.rootFoldersCollection);
|
||||
model.set('qualityProfiles', context.qualityProfilesCollection);
|
||||
});
|
||||
|
||||
context.searchResult.show(context.resultView);
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
</div>
|
||||
<div id="{{id}}" class="accordion-body collapse">
|
||||
<div class="accordion-inner">
|
||||
<select class="root-dir-input span7">
|
||||
{{#each rootFolders}}
|
||||
<select class="span7 x-root-folder">
|
||||
{{#each rootFolders.models}}
|
||||
<option value="{{id}}">{{attributes.path}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
<select class="quality-profile-input span2">
|
||||
{{#each qualityProfiles}}
|
||||
<select class="span2 x-quality-profile">
|
||||
{{#each qualityProfiles.models}}
|
||||
<option value="{{id}}">{{attributes.name}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
<div class="btn btn-success pull-right icon-plus">
|
||||
<div class="btn btn-success pull-right icon-plus x-add">
|
||||
</div>
|
||||
</div>
|
||||
<div name="overview"></div>
|
||||
|
||||
@@ -1,17 +1,47 @@
|
||||
/// <reference path="../../app.js" />
|
||||
/// <reference path="../SearchResultModel.js" />
|
||||
/// <reference path="../../Series/SeriesModel.js" />
|
||||
/// <reference path="../SearchResultCollection.js" />
|
||||
|
||||
NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
||||
template: "AddSeries/AddNewSeries/SearchResultTemplate",
|
||||
className: 'search-item accordion-group',
|
||||
|
||||
ui: {
|
||||
qualityProfile: '.x-quality-profile',
|
||||
rootFolder: '.x-root-folder'
|
||||
},
|
||||
|
||||
events: {
|
||||
'click .x-add': 'add'
|
||||
},
|
||||
|
||||
onRender: function () {
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
//this.listenTo(this.model.get('rootFolders'), 'reset', this.render);
|
||||
//this.listenTo(this.model.get('qualityProfiles'), 'reset', this.render);
|
||||
},
|
||||
|
||||
add: function () {
|
||||
|
||||
var seriesId = this.model.get('id');
|
||||
var title = this.model.get('seriesName');
|
||||
var quality = this.ui.qualityProfile.val();
|
||||
var rootFolderId = this.ui.rootFolder.val();
|
||||
|
||||
var rootPath = this.model.get('rootFolders').get(rootFolderId).get('path');
|
||||
var path = rootPath + "\\" + title;
|
||||
|
||||
var model = new NzbDrone.Series.SeriesModel({
|
||||
seriesId: seriesId,
|
||||
title: title,
|
||||
qualityProfileId: quality,
|
||||
path: path
|
||||
});
|
||||
|
||||
model.save();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
|
||||
@@ -23,5 +53,7 @@ NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend(
|
||||
initialize: function () {
|
||||
this.listenTo(this.collection, 'reset', this.render);
|
||||
},
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/// <reference path="../app.js" />
|
||||
/// <reference path="SearchResultModel.js" />
|
||||
"use strict";
|
||||
|
||||
NzbDrone.AddSeries.SearchResultCollection = Backbone.Collection.extend({
|
||||
url: NzbDrone.Constants.ApiRoot + '/series/lookup',
|
||||
model: NzbDrone.AddSeries.SearchResultModel,
|
||||
model: NzbDrone.AddSeries.SearchResultModel
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ _.extend(Marionette.TemplateCache.prototype, {
|
||||
|
||||
console.log("Loading template '" + templateId + "'");
|
||||
|
||||
jQuery.ajax({
|
||||
$.ajax({
|
||||
url: '_backboneApp//' + templateId + '.html',
|
||||
cache:false,
|
||||
async: false
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
NzbDrone.Series.SeriesModel = Backbone.Model.extend({
|
||||
url: NzbDrone.Constants.ApiRoot + '/series'
|
||||
|
||||
});
|
||||
|
||||
|
||||
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
|
||||
model: NzbDrone.Series.SeriesModel,
|
||||
url: NzbDrone.Constants.ApiRoot + '/series',
|
||||
});
|
||||
@@ -9,6 +9,13 @@ NzbDrone.Shared.ErrorCollection = Backbone.Collection.extend({
|
||||
|
||||
NzbDrone.Shared.ErrorModel = Backbone.Model.extend({
|
||||
|
||||
mutators: {
|
||||
pre: function () {
|
||||
return this.get('message').lines().lenght > 1;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
defaults: {
|
||||
"title": "NO_TITLE",
|
||||
"message": "NO_MESSAGE",
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<div class="alert alert-error">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<i class="icon-warning-sign" /><strong>{{title}}</strong> {{message}}
|
||||
<i class="icon-warning-sign" /><strong>{{title}}</strong>
|
||||
{{#if preFormatted}}
|
||||
<pre> {{message}}</pre>
|
||||
{{else}}
|
||||
{{message}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@ if (typeof console == "undefined") {
|
||||
}
|
||||
|
||||
NzbDrone = new Backbone.Marionette.Application();
|
||||
NzbDrone.Series = NzbDrone.module("Series");
|
||||
NzbDrone.AddSeries = NzbDrone.module("AddSeries");
|
||||
NzbDrone.Quality = NzbDrone.module("Quality");
|
||||
NzbDrone.Shared = NzbDrone.module("Shared");
|
||||
@@ -36,14 +37,14 @@ NzbDrone.Constants = {
|
||||
};
|
||||
|
||||
NzbDrone.Events = {
|
||||
DisplayInMainRegion: "DisplayInMainRegion",
|
||||
DisplayInMainRegion: "DisplayInMainRegion"
|
||||
};
|
||||
|
||||
|
||||
NzbDrone.Routes = {
|
||||
Series: {
|
||||
Add: 'series/add',
|
||||
},
|
||||
Add: 'series/add'
|
||||
}
|
||||
};
|
||||
|
||||
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
|
||||
@@ -55,7 +56,7 @@ NzbDrone.Controller = Backbone.Marionette.Controller.extend({
|
||||
|
||||
notFound: function () {
|
||||
alert('route not found');
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -78,7 +79,7 @@ NzbDrone.addInitializer(function (options) {
|
||||
|
||||
NzbDrone.addRegions({
|
||||
mainRegion: "#main-region",
|
||||
errorRegion: "#error-region",
|
||||
errorRegion: "#error-region"
|
||||
});
|
||||
|
||||
NzbDrone.Router = new NzbDrone.Router();
|
||||
|
||||
Reference in New Issue
Block a user