1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 09:18:34 +00:00

created add series layout.

This commit is contained in:
Keivan Beigi 2013-01-22 11:52:49 -08:00 committed by kay.one
parent 74a5939c96
commit f303c33ed8
5 changed files with 50 additions and 72 deletions

View file

@ -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" />

View file

@ -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>

View file

@ -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>

View file

@ -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');
}
})
.data("autocomplete")._renderItem = function (ul, item) {
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.ImportExistingView = Backbone.Marionette.ItemView.extend({
template: "#add-existing-series", template: "AddSeries/ImportExistingTemplate",
events: {
'click #single': 'single',
'click #multiple': 'multiple'
},
single: function () {
NzbDrone.Router.navigate(NzbDrone.Routes.Series.AddExistingSingle, { trigger: true });
},
multiple: function () {
NzbDrone.Router.navigate(NzbDrone.Routes.Series.AddExistingMultiple, { trigger: true });
}
}); });
NzbDrone.AddExistingSeriesSingleView = Backbone.Marionette.ItemView.extend({ NzbDrone.RootFoldersView = Backbone.Marionette.ItemView.extend({
template: "#add-existing-series-single" template: "AddSeries/RootFoldersTemplate",
}); });
NzbDrone.AddExistingSeriesMultipleView = Backbone.Marionette.ItemView.extend({ NzbDrone.AddSeriesLayout = Backbone.Marionette.Layout.extend({
template: "#add-existing-series-multiple" template: "AddSeries/addSeriesLayoutTemplate",
})
regions: {
addNew: "#add-new",
importExisting: "#import-existing",
rootFolders: "#root-folders"
},
onRender: function () {
this.$('#myTab a').click(function (e) {
e.preventDefault();
$(this).tab('show');
});
this.addNew.show(new NzbDrone.AddNewSeriesView());
this.importExisting.show(new NzbDrone.ImportExistingView());
this.rootFolders.show(new NzbDrone.RootFoldersView());
},
});

View file

@ -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());
}, },