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

@@ -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;
/*
this.ui.seriesSearch
.data('timeout', null)
.keyup(function () {
clearTimeout(self.$el.data('timeout'));
self.$el.data('timeout', setTimeout(self.search, 500, self));
});
*/
//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) {