added ui structure for rootdirs.

pull/4/head
Keivan Beigi 12 years ago committed by kay.one
parent ae61150b84
commit 157b559ed2

@ -89,6 +89,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="QualityProfiles\RootFolderModule.cs" />
<Compile Include="Series\SeriesModule.cs" /> <Compile Include="Series\SeriesModule.cs" />
<Compile Include="ErrorManagment\ApiException.cs" /> <Compile Include="ErrorManagment\ApiException.cs" />
<Compile Include="Bootstrapper.cs" /> <Compile Include="Bootstrapper.cs" />

@ -0,0 +1,32 @@
using Nancy;
using NzbDrone.Core.Providers;
using NzbDrone.Api.QualityType;
using NzbDrone.Core.Repository;
namespace NzbDrone.Api.QualityProfiles
{
public class RootFolderModule : NzbDroneApiModule
{
private readonly RootDirProvider _rootDirProvider;
public RootFolderModule(RootDirProvider rootDirProvider)
: base("//rootfolders")
{
_rootDirProvider = rootDirProvider;
Get["/"] = x => GetRootFolders();
Post["/"] = x => AddRootFolder();
}
private Response AddRootFolder()
{
_rootDirProvider.Add(Request.Body.FromJson<RootDir>());
return new Response { StatusCode = HttpStatusCode.Created };
}
private Response GetRootFolders()
{
return _rootDirProvider.AllWithFreeSpace().AsResponse();
}
}
}

@ -182,6 +182,11 @@
<ItemGroup> <ItemGroup>
<Compile Include="App_Start\DataTablesMvc.cs" /> <Compile Include="App_Start\DataTablesMvc.cs" />
<Compile Include="App_Start\MiniProfiler.cs" /> <Compile Include="App_Start\MiniProfiler.cs" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirView.js" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirItemTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirModel.js" />
<Content Include="_backboneApp\AddSeries\RootDir\RootDirCollection.js" />
<Content Include="_backboneApp\JsLibraries\backbone.modelbinder.js" /> <Content Include="_backboneApp\JsLibraries\backbone.modelbinder.js" />
<Content Include="_backboneApp\AddSeries\AddNewSeries\AddNewSeriesTemplate.html" /> <Content Include="_backboneApp\AddSeries\AddNewSeries\AddNewSeriesTemplate.html" />
<Content Include="_backboneApp\AddSeries\AddNewSeries\AddNewSeriesView.js" /> <Content Include="_backboneApp\AddSeries\AddNewSeries\AddNewSeriesView.js" />

@ -1,5 +1,5 @@
<div class="tab-pane" id="add-new"> <div class="tab-pane" id="add-new">
<div class="input-prepend search"> <div class="input-prepend nz-input-large search">
<i class="add-on icon-search"></i> <i class="add-on icon-search"></i>
<input type="text" class="span10" placeholder="Start typing the name of series you want to add ..."> <input type="text" class="span10" placeholder="Start typing the name of series you want to add ...">
</div> </div>

@ -6,9 +6,6 @@ NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/AddNewSeries/SearchResultTemplate", template: "AddSeries/AddNewSeries/SearchResultTemplate",
className: 'row', className: 'row',
initialize: function () {
this.listenTo(this.model, 'reset', function () { alert('model'); });
},
onRender: function () { onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el); NzbDrone.ModelBinder.bind(this.model, this.el);

@ -1,5 +1,6 @@
/// <reference path="../app.js" /> /// <reference path="../app.js" />
/// <reference path="AddNewSeries/AddNewSeriesView.js" /> /// <reference path="AddNewSeries/AddNewSeriesView.js" />
/// <reference path="RootDir/RootDirView.js" />
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
template: "AddSeries/addSeriesLayoutTemplate", template: "AddSeries/addSeriesLayoutTemplate",
@ -18,7 +19,7 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView()); this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView());
//this.importExisting.show(new NzbDrone.ImportExistingView()); //this.importExisting.show(new NzbDrone.ImportExistingView());
//this.rootFolders.show(new NzbDrone.RootFoldersView()); this.rootFolders.show(new NzbDrone.AddSeries.RootDirView());
}, },
}); });

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

@ -0,0 +1,4 @@
<div>
<div name="Path"/>
<div name="FreeSpace"/>
</div>

@ -0,0 +1,4 @@
/// <reference path="../../app.js" />
NzbDrone.AddSeries.RootDirModel = Backbone.Model.extend({
});

@ -0,0 +1,9 @@
<div class="tab-pane" id="root-dir">
<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>
</div>

@ -0,0 +1,62 @@
/// <reference path="../../app.js" />
/// <reference path="RootDirModel.js" />
/// <reference path="RootDirCollection.js" />
NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/RootDir/RootDirItemTemplate",
className: 'row',
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
}
});
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
className: 'result',
itemView: NzbDrone.AddSeries.RootDirItemView,
});
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
template: "AddSeries/RootDir/RootDirTemplate",
ui: {
pathInput: '.path input'
},
regions: {
currentDirs: "#current-dirs",
},
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));
});
*/
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
},
search: function (context) {
var term = context.ui.seriesSearch.val();
if (term == "") {
context.collection.reset();
} else {
console.log(term);
context.collection.fetch({ data: $.param({ term: term }) });
}
},
});

@ -1,15 +1,18 @@
.search { .nz-input-large {
margin-top: 20px; margin-top: 20px;
} }
.search input { .nz-input-large input {
height: 40px; height: 40px;
} }
.search .add-on { .nz-input-large *[class*='icon-'] {
font-size: 30px; font-size: 30px;
height: 30px; height: 30px;
width: 40px; width: 40px;
padding-top: 14px; padding-top: 14px;
padding-left: 10px; padding-left: 10px;
} }

Loading…
Cancel
Save