created add series layout.

pull/3113/head
Keivan Beigi 12 years ago committed by kay.one
parent 74a5939c96
commit f303c33ed8

@ -185,6 +185,7 @@
<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\addNewSeriesTemplate.html" />
<Content Include="_backboneApp\Content\Intelisense\bootstrap.css" /> <Content Include="_backboneApp\Content\Intelisense\bootstrap.css" />
<Content Include="_backboneApp\JsLibraries\backbone.marionette.extend.js" /> <Content Include="_backboneApp\JsLibraries\backbone.marionette.extend.js" />
<Compile Include="_backboneApp\CassetteConfiguration.cs" /> <Compile Include="_backboneApp\CassetteConfiguration.cs" />
@ -373,7 +374,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="_backboneApp\JsLibraries\backbone.js" /> <Content Include="_backboneApp\JsLibraries\backbone.js" />
<Content Include="_backboneApp\JsLibraries\backbone.marionette.js" /> <Content Include="_backboneApp\JsLibraries\backbone.marionette.js" />
<Content Include="_backboneApp\AddSeries\addSeriesTemplate.html" /> <Content Include="_backboneApp\AddSeries\addSeriesLayoutTemplate.html" />
<Content Include="Cassette.targets" /> <Content Include="Cassette.targets" />
<None Include="_backboneApp\JsLibraries\jquery-1.8.2.intellisense.js" /> <None Include="_backboneApp\JsLibraries\jquery-1.8.2.intellisense.js" />
<Content Include="_backboneApp\JsLibraries\jquery-1.8.2.js" /> <Content Include="_backboneApp\JsLibraries\jquery-1.8.2.js" />

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

@ -4,12 +4,7 @@
<li><a href="#root-folders">Root Folders</a></li> <li><a href="#root-folders">Root Folders</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="add-new"> <div class="tab-pane active" id="add-new">Add new series.</div>
<div class="input-prepend search">
<i class="add-on icon-search"></i>
<input type="text" class="span10" placeholder="Start typing the name of series you want to add ...">
</div>
</div>
<div class="tab-pane" id="import-existing">Import existing.</div> <div class="tab-pane" id="import-existing">Import existing.</div>
<div class="tab-pane" id="root-folders">Manage root folders</div> <div class="tab-pane" id="root-folders">Manage root folders</div>
</div> </div>

@ -1,80 +1,56 @@
NzbDrone.AddSeriesView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/addSeriesTemplate", template: "AddSeries/addNewSeriesTemplate",
initialise: function () {
},
onRender: function () {
this.$el.find('#myTab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
},
});
NzbDrone.AddNewSeriesView = Backbone.Marionette.ItemView.extend({
template: "#add-new-series",
ui: { ui: {
seriesSearch: '#series-search' seriesSearch: '.search input'
}, },
onRender: function () { onRender: function () {
console.log('binding auto complete'); console.log('binding auto complete');
var self = this; var self = this;
this.ui.seriesSearch this.ui.seriesSearch
.autocomplete({ .data('timeout', null)
source: "http://localhost:1232/api/series/lookup", .keyup(function () {
minLength: 1, clearTimeout(self.$el.data('timeout'));
delay: 500, self.$el.data('timeout', setTimeout(self.search, 500, self));
select: function (event, ui) { });
$(this).val(ui.item.Title);
$(this).siblings('.seriesId').val(ui.item.Id);
return false;
}, },
open: function (event, ui) {
$('.ui-autocomplete').addClass('seriesLookupResults'); search: function (context) {
console.log(context.ui.seriesSearch.val());
}, },
close: function (event, ui) { });
$('.ui-autocomplete').removeClass('seriesLookupResults');
}
}) NzbDrone.ImportExistingView = Backbone.Marionette.ItemView.extend({
.data("autocomplete")._renderItem = function (ul, item) { template: "AddSeries/ImportExistingTemplate",
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + item.SeriesName + "<img src='../../Content/Images/thetvdb.png' class='tvDbLink' title='Click to see series details from TheTVDB' rel='" + item.Url + "' /></a>")
.appendTo(ul);
};
}
}); });
NzbDrone.AddExistingSeriesView = Backbone.Marionette.ItemView.extend({ NzbDrone.RootFoldersView = Backbone.Marionette.ItemView.extend({
template: "#add-existing-series", template: "AddSeries/RootFoldersTemplate",
events: { });
'click #single': 'single',
'click #multiple': 'multiple' NzbDrone.AddSeriesLayout = Backbone.Marionette.Layout.extend({
}, template: "AddSeries/addSeriesLayoutTemplate",
single: function () { regions: {
NzbDrone.Router.navigate(NzbDrone.Routes.Series.AddExistingSingle, { trigger: true }); addNew: "#add-new",
importExisting: "#import-existing",
rootFolders: "#root-folders"
}, },
multiple: function () { onRender: function () {
NzbDrone.Router.navigate(NzbDrone.Routes.Series.AddExistingMultiple, { trigger: true }); this.$('#myTab a').click(function (e) {
} e.preventDefault();
$(this).tab('show');
}); });
NzbDrone.AddExistingSeriesSingleView = Backbone.Marionette.ItemView.extend({ this.addNew.show(new NzbDrone.AddNewSeriesView());
template: "#add-existing-series-single" this.importExisting.show(new NzbDrone.ImportExistingView());
}); this.rootFolders.show(new NzbDrone.RootFoldersView());
},
NzbDrone.AddExistingSeriesMultipleView = Backbone.Marionette.ItemView.extend({ });
template: "#add-existing-series-multiple"
})

@ -21,7 +21,7 @@ NzbDrone.Routes = {
NzbDrone.Controller = Backbone.Marionette.Controller.extend({ NzbDrone.Controller = Backbone.Marionette.Controller.extend({
addSeries: function () { addSeries: function () {
NzbDrone.mainRegion.show(new NzbDrone.AddSeriesView()); NzbDrone.mainRegion.show(new NzbDrone.AddSeriesLayout());
}, },

Loading…
Cancel
Save