1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

added root dir management. delete doesn't work for some reason.

This commit is contained in:
Keivan Beigi 2013-01-24 16:02:53 -08:00 committed by kay.one
parent 157b559ed2
commit d34092c015
8 changed files with 65 additions and 24 deletions

View File

@ -5,12 +5,12 @@
namespace NzbDrone.Api.QualityProfiles
{
public class RootFolderModule : NzbDroneApiModule
public class RootDirModule : NzbDroneApiModule
{
private readonly RootDirProvider _rootDirProvider;
public RootFolderModule(RootDirProvider rootDirProvider)
: base("//rootfolders")
public RootDirModule(RootDirProvider rootDirProvider)
: base("//rootdir")
{
_rootDirProvider = rootDirProvider;

View File

@ -26,6 +26,7 @@ NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend(
NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
template: "AddSeries/AddNewSeries/AddNewSeriesTemplate",
route : "Series/add/new",
ui: {
seriesSearch: '.search input'
@ -39,6 +40,7 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
onRender: function () {
//NzbDrone.Router.navigate(this.route, { trigger: true });
console.log('binding auto complete');
var self = this;

View File

@ -1,4 +1,6 @@
<div>
<div name="Path"/>
<div name="FreeSpace"/>
</div>
<td name="Path" class="span10" />
<td name="FreeSpace" class="span3" />
<td class="span1 nz-row-action">
<div id="remove-dir" class="btn btn-danger icon-minus">
</div>
</td>

View File

@ -1,4 +1,4 @@
/// <reference path="../../app.js" />
NzbDrone.AddSeries.RootDirModel = Backbone.Model.extend({
url: NzbDrone.Constants.ApiRoot + 'rootdir/',
});

View File

@ -2,8 +2,7 @@
<div class="input-prepend input-append nz-input-large path">
<i class="add-on icon-folder-open"></i>
<input type="text" class="span10" placeholder="Path of the root folder you would like to add">
<div class="btn icon-plus btn-success"/>
</div>
<div id="current-dirs">
<div id="add-dir" class="btn icon-plus btn-success" />
</div>
<div class="span15 offset2 result-list" id="current-dirs" />
</div>

View File

@ -5,21 +5,32 @@
NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/RootDir/RootDirItemTemplate",
className: 'row',
tagName: 'tr',
events: {
'click #remove-dir': 'removeDir',
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
},
removeDir: function () {
this.model.destroy({ wait: true });
},
});
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
className: 'result',
itemView: NzbDrone.AddSeries.RootDirItemView,
tagName: 'table',
className: 'table table-hover',
});
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
template: "AddSeries/RootDir/RootDirTemplate",
route: "series/add/rootdir",
ui: {
pathInput: '.path input'
@ -29,21 +40,41 @@ NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
currentDirs: "#current-dirs",
},
events: {
'click #add-dir': 'addDir',
},
collection: new NzbDrone.AddSeries.RootDirCollection(),
onRender: function () {
var self = this;
/*
//NzbDrone.Router.navigate(this.route, { trigger: true });
/*
this.ui.seriesSearch
.data('timeout', null)
.keyup(function () {
clearTimeout(self.$el.data('timeout'));
self.$el.data('timeout', setTimeout(self.search, 500, self));
});
*/
*/
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) {

View File

@ -1,5 +1,6 @@
.nz-input-large {
margin-top: 20px;
margin-bottom: 40px;
}
.nz-input-large input {
@ -14,5 +15,11 @@
padding-left: 10px;
}
.result-list {
font-size: 18px;
text-align: left;
}

View File

@ -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(),
// "someMethod" must exist at controller.someMethod
@ -68,7 +68,7 @@ NzbDrone.addInitializer(function (options) {
mainRegion: "#main-region",
});
NzbDrone.Router = new NzbDrone.MyRouter();
NzbDrone.Router = new NzbDrone.Router();
Backbone.history.start();