added first region,view and routes.

This commit is contained in:
Keivan Beigi 2013-01-18 14:05:52 -08:00 committed by kay.one
parent 9f304b7be5
commit 85fa96f436
5 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,3 @@
NzbDrone.AddSeriesView = Backbone.Marionette.ItemView.extend({
template: "#add-series-template"
});

View File

@ -38,7 +38,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Content Include="AddSeries\Views\addSeriesView.js" />
<Content Include="app.js" />
<Content Include="bootstrap.js" />
<Content Include="index.html" />
<Content Include="JsLibraries\backbone.js" />
<None Include="JsLibraries\jquery-1.8.2.intellisense.js" />
<Content Include="JsLibraries\backbone.marionette.js" />
@ -64,6 +67,7 @@
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup />
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@ -1,7 +1,27 @@
NzbDrone = new Backbone.Marionette.Application();
NzbDrone.Controller = {
AddSeries: function () {
var view = new NzbDrone.AddSeriesView();
NzbDrone.mainRegion.show(view);
},
AddNewSeries: function () {
alert("AddNewSeries");
},
AddExistingSeries: function () {
alert("AddExistingSeries");
}
};
NzbDrone.MyRouter = Backbone.Marionette.AppRouter.extend({
controller: NzbDrone.Controller,
// "someMethod" must exist at controller.someMethod
appRoutes: {
"add": "AddSeries",
@ -12,6 +32,16 @@ NzbDrone.MyRouter = Backbone.Marionette.AppRouter.extend({
});
NzbDrone.addInitializer(function (options) {
new NzbDrone.MyRouter();
console.log("starting application");
NzbDrone.addRegions({
mainRegion: "#main-region",
});
NzbDrone.Router = new NzbDrone.MyRouter();
Backbone.history.start();
});

1
NzbDrone.Backbone/bootstrap.js vendored Normal file
View File

@ -0,0 +1 @@
NzbDrone.start();

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div style="display: none">
<div id="add-series-template">
<h1>Add new series</h1>
</div>
</div>
<div id="main-region"></div>
<script src="JsLibraries/jquery-1.8.2.js" type="text/javascript"></script>
<script src="JsLibraries/underscore.js" type="text/javascript"></script>
<script src="JsLibraries/backbone.js" type="text/javascript"></script>
<script src="JsLibraries/backbone.marionette.js" type="text/javascript"></script>
<script src="app.js" type="text/javascript"></script>
<script src="AddSeries/Views/addSeriesView.js" type="text/javascript"></script>
<script src="bootstrap.js" type="text/javascript"></script>
</body>
</html>