From 85fa96f43693454257eb97324cea5905970c7cbc Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Fri, 18 Jan 2013 14:05:52 -0800 Subject: [PATCH] added first region,view and routes. --- .../AddSeries/Views/addSeriesView.js | 3 ++ NzbDrone.Backbone/NzbDrone.Backbone.csproj | 4 +++ NzbDrone.Backbone/app.js | 32 ++++++++++++++++++- NzbDrone.Backbone/bootstrap.js | 1 + NzbDrone.Backbone/index.html | 27 ++++++++++++++++ 5 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 NzbDrone.Backbone/AddSeries/Views/addSeriesView.js create mode 100644 NzbDrone.Backbone/bootstrap.js create mode 100644 NzbDrone.Backbone/index.html diff --git a/NzbDrone.Backbone/AddSeries/Views/addSeriesView.js b/NzbDrone.Backbone/AddSeries/Views/addSeriesView.js new file mode 100644 index 000000000..135953b71 --- /dev/null +++ b/NzbDrone.Backbone/AddSeries/Views/addSeriesView.js @@ -0,0 +1,3 @@ +NzbDrone.AddSeriesView = Backbone.Marionette.ItemView.extend({ + template: "#add-series-template" +}); \ No newline at end of file diff --git a/NzbDrone.Backbone/NzbDrone.Backbone.csproj b/NzbDrone.Backbone/NzbDrone.Backbone.csproj index 6b52906bf..928b87704 100644 --- a/NzbDrone.Backbone/NzbDrone.Backbone.csproj +++ b/NzbDrone.Backbone/NzbDrone.Backbone.csproj @@ -38,7 +38,10 @@ 4 + + + @@ -64,6 +67,7 @@ + 10.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) diff --git a/NzbDrone.Backbone/app.js b/NzbDrone.Backbone/app.js index 0791ee03b..5d39f9334 100644 --- a/NzbDrone.Backbone/app.js +++ b/NzbDrone.Backbone/app.js @@ -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(); + + }); \ No newline at end of file diff --git a/NzbDrone.Backbone/bootstrap.js b/NzbDrone.Backbone/bootstrap.js new file mode 100644 index 000000000..3634284b0 --- /dev/null +++ b/NzbDrone.Backbone/bootstrap.js @@ -0,0 +1 @@ +NzbDrone.start(); \ No newline at end of file diff --git a/NzbDrone.Backbone/index.html b/NzbDrone.Backbone/index.html new file mode 100644 index 000000000..56ac20fc5 --- /dev/null +++ b/NzbDrone.Backbone/index.html @@ -0,0 +1,27 @@ + + + + + + +
+
+

Add new series

+
+
+ +
+ + + + + + + + + + + + + +