mirror of https://github.com/Sonarr/Sonarr
added root dir management. delete doesn't work for some reason.
This commit is contained in:
parent
157b559ed2
commit
d34092c015
|
@ -5,12 +5,12 @@ using NzbDrone.Core.Repository;
|
||||||
|
|
||||||
namespace NzbDrone.Api.QualityProfiles
|
namespace NzbDrone.Api.QualityProfiles
|
||||||
{
|
{
|
||||||
public class RootFolderModule : NzbDroneApiModule
|
public class RootDirModule : NzbDroneApiModule
|
||||||
{
|
{
|
||||||
private readonly RootDirProvider _rootDirProvider;
|
private readonly RootDirProvider _rootDirProvider;
|
||||||
|
|
||||||
public RootFolderModule(RootDirProvider rootDirProvider)
|
public RootDirModule(RootDirProvider rootDirProvider)
|
||||||
: base("//rootfolders")
|
: base("//rootdir")
|
||||||
{
|
{
|
||||||
_rootDirProvider = rootDirProvider;
|
_rootDirProvider = rootDirProvider;
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend(
|
||||||
|
|
||||||
NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||||
template: "AddSeries/AddNewSeries/AddNewSeriesTemplate",
|
template: "AddSeries/AddNewSeries/AddNewSeriesTemplate",
|
||||||
|
route : "Series/add/new",
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
seriesSearch: '.search input'
|
seriesSearch: '.search input'
|
||||||
|
@ -39,6 +40,7 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
|
|
||||||
|
//NzbDrone.Router.navigate(this.route, { trigger: true });
|
||||||
console.log('binding auto complete');
|
console.log('binding auto complete');
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<div>
|
<td name="Path" class="span10" />
|
||||||
<div name="Path"/>
|
<td name="FreeSpace" class="span3" />
|
||||||
<div name="FreeSpace"/>
|
<td class="span1 nz-row-action">
|
||||||
|
<div id="remove-dir" class="btn btn-danger icon-minus">
|
||||||
</div>
|
</div>
|
||||||
|
</td>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/// <reference path="../../app.js" />
|
/// <reference path="../../app.js" />
|
||||||
NzbDrone.AddSeries.RootDirModel = Backbone.Model.extend({
|
NzbDrone.AddSeries.RootDirModel = Backbone.Model.extend({
|
||||||
|
url: NzbDrone.Constants.ApiRoot + 'rootdir/',
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
<div class="input-prepend input-append nz-input-large path">
|
<div class="input-prepend input-append nz-input-large path">
|
||||||
<i class="add-on icon-folder-open"></i>
|
<i class="add-on icon-folder-open"></i>
|
||||||
<input type="text" class="span10" placeholder="Path of the root folder you would like to add">
|
<input type="text" class="span10" placeholder="Path of the root folder you would like to add">
|
||||||
<div class="btn icon-plus btn-success"/>
|
<div id="add-dir" class="btn icon-plus btn-success" />
|
||||||
</div>
|
|
||||||
<div id="current-dirs">
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span15 offset2 result-list" id="current-dirs" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,21 +5,32 @@
|
||||||
NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
||||||
template: "AddSeries/RootDir/RootDirItemTemplate",
|
template: "AddSeries/RootDir/RootDirItemTemplate",
|
||||||
className: 'row',
|
tagName: 'tr',
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click #remove-dir': 'removeDir',
|
||||||
|
},
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
NzbDrone.ModelBinder.bind(this.model, this.el);
|
NzbDrone.ModelBinder.bind(this.model, this.el);
|
||||||
}
|
},
|
||||||
|
|
||||||
|
removeDir: function () {
|
||||||
|
this.model.destroy({ wait: true });
|
||||||
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
|
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
|
||||||
className: 'result',
|
|
||||||
itemView: NzbDrone.AddSeries.RootDirItemView,
|
itemView: NzbDrone.AddSeries.RootDirItemView,
|
||||||
|
|
||||||
|
tagName: 'table',
|
||||||
|
className: 'table table-hover',
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
|
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
|
||||||
template: "AddSeries/RootDir/RootDirTemplate",
|
template: "AddSeries/RootDir/RootDirTemplate",
|
||||||
|
route: "series/add/rootdir",
|
||||||
|
|
||||||
ui: {
|
ui: {
|
||||||
pathInput: '.path input'
|
pathInput: '.path input'
|
||||||
|
@ -29,11 +40,18 @@ NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
|
||||||
currentDirs: "#current-dirs",
|
currentDirs: "#current-dirs",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
events: {
|
||||||
|
'click #add-dir': 'addDir',
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
collection: new NzbDrone.AddSeries.RootDirCollection(),
|
collection: new NzbDrone.AddSeries.RootDirCollection(),
|
||||||
|
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
//NzbDrone.Router.navigate(this.route, { trigger: true });
|
||||||
|
|
||||||
/*
|
/*
|
||||||
this.ui.seriesSearch
|
this.ui.seriesSearch
|
||||||
.data('timeout', null)
|
.data('timeout', null)
|
||||||
|
@ -44,6 +62,19 @@ NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
|
||||||
*/
|
*/
|
||||||
|
|
||||||
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
|
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
|
||||||
|
|
||||||
|
this.collection.fetch();
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
addDir: function () {
|
||||||
|
var newDir = new NzbDrone.AddSeries.RootDirModel(
|
||||||
|
{
|
||||||
|
Path: this.ui.pathInput.val()
|
||||||
|
});
|
||||||
|
|
||||||
|
this.collection.create(newDir, { wait: true });
|
||||||
|
this.fetch();
|
||||||
},
|
},
|
||||||
|
|
||||||
search: function (context) {
|
search: function (context) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
.nz-input-large {
|
.nz-input-large {
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nz-input-large input {
|
.nz-input-large input {
|
||||||
|
@ -14,5 +15,11 @@
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.result-list {
|
||||||
|
font-size: 18px;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ NzbDrone.Controller = Backbone.Marionette.Controller.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.MyRouter = Backbone.Marionette.AppRouter.extend({
|
NzbDrone.Router = Backbone.Marionette.AppRouter.extend({
|
||||||
|
|
||||||
controller: new NzbDrone.Controller(),
|
controller: new NzbDrone.Controller(),
|
||||||
// "someMethod" must exist at controller.someMethod
|
// "someMethod" must exist at controller.someMethod
|
||||||
|
@ -68,7 +68,7 @@ NzbDrone.addInitializer(function (options) {
|
||||||
mainRegion: "#main-region",
|
mainRegion: "#main-region",
|
||||||
});
|
});
|
||||||
|
|
||||||
NzbDrone.Router = new NzbDrone.MyRouter();
|
NzbDrone.Router = new NzbDrone.Router();
|
||||||
Backbone.history.start();
|
Backbone.history.start();
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue