Revisions
-
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -114,7 +114,7 @@ MyApp.start(); // commands MyApp = new Marionette.Application(); MyApp.commands.setHandler("foo", function(){ console.log("FOO HIT"); }); MyApp.execute("foo"); @@ -124,7 +124,7 @@ MyApp.execute("foo"); // Request/Response MyApp = new Marionette.Application(); MyApp.reqres.setHandler("foo",function(){ return "RESPONSE HIT"; }); MyApp.request("foo"); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 28 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -109,3 +109,31 @@ MyApp.addInitializer(function(options){ MyApp.start(); // commands MyApp = new Marionette.Application(); MyApp.commands.register("foo", function(){ console.log("FOO HIT"); }); MyApp.execute("foo"); // Request/Response MyApp = new Marionette.Application(); MyApp.reqres.register("foo",function(){ return "RESPONSE HIT"; }); MyApp.request("foo"); // Event MyApp = new Backbone.Marionette.Application(); MyApp.vent.on("foo", function(){ alert("bar"); }); MyApp.vent.trigger("foo"); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 19 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -90,3 +90,22 @@ var MyRouter = new Marionette.AppRouter({ } }); // Application MyApp = new Backbone.Marionette.Application(); MyApp.addRegions({ mainRegion: "#main-div" }); MyApp.addInitializer(function(options){ var myView = new MyView({ model: options.someModel }); MyApp.mainRegion.show(myView); }); MyApp.addInitializer(function(options){ new MyAppRouter(); Backbone.history.start(); }); MyApp.start(); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 17 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,4 +73,20 @@ var layout = new AppLayout(); layout.render(); layout.menu.show(new MenuView()); layout.content.show(new MainContentView()); // AppRouter + Controller myController = Marionette.Controller.extend({ doFoo: function(){ console.log("FOO!"); } }); var MyRouter = new Marionette.AppRouter({ controller: myController, appRoutes: { "foo": "doFoo" } }); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -54,12 +54,9 @@ var GridView = Backbone.Marionette.CompositeView.extend({ // Region var myView = new MyView(); mainRegion.show(myView); mainRegion.close(); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,4 +73,7 @@ AppLayout = Backbone.Marionette.Layout.extend({ } }); var layout = new AppLayout(); layout.render(); layout.menu.show(new MenuView()); layout.content.show(new MainContentView()); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,3 +60,17 @@ MyApp.addRegions({ var myView = new MyView(); MyApp.mainRegion.show(myView); MyApp.mainRegion.close(); // Layout AppLayout = Backbone.Marionette.Layout.extend({ template: "#layout-template", regions: { menu: "#menu", content: "#content" } }); var layout = new AppLayout(); layout.render(); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,3 +50,13 @@ var GridView = Backbone.Marionette.CompositeView.extend({ collectionView.$("tbody").append(itemView.el); } }); // Region MyApp.addRegions({ mainRegion: "#main" }); var myView = new MyView(); MyApp.mainRegion.show(myView); MyApp.mainRegion.close(); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,3 +34,19 @@ MenuListView = Marionette.CollectionView.extend({ var menuList = new MenuListView({collection: menu}); menuList.render(); // CompositeView var GridRow = Backbone.Marionette.ItemView.extend({ template: "#row-template", tagName: "tr" }); var GridView = Backbone.Marionette.CompositeView.extend({ tagName: "table", template: "#grid-template", itemView: GridRow, appendHtml: function(collectionView, itemView){ collectionView.$("tbody").append(itemView.el); } }); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 5 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,10 @@ view.render(); // Collection View MenuListView = Marionette.CollectionView.extend({ tagName: "ul", itemView: MenuItemView }); var menuList = new MenuListView({collection: menu}); menuList.render(); -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,3 +23,11 @@ MyView = Backbone.Marionette.ItemView.extend({ }); var view = new MyView({model: myModel}); view.render(); // Collection View menuListView = Marionette.CollectionView.extend({ tagName: "ul", itemView: MenuItemView }) -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 2 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,15 +3,8 @@ var MyView = Marionette.ItemView.extend({ template: "my-template-id" }); var myView = new MyView({ model: Dog}); myView.render(); // ItemView sample -
lxyuma revised this gist
Sep 7, 2013 . 1 changed file with 16 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,19 @@ // sample var MyView = Marionette.ItemView.extend({ template: "my-template-id" }); var view = new View({ model : Dog}); view.render(); // ItemView sample MyView = Backbone.Marionette.ItemView.extend({ -
lxyuma created this gist
Sep 3, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ // ItemView sample MyView = Backbone.Marionette.ItemView.extend({ template: "#myTemplate", ui: { "flag" : "#myFlag" }, modelEvents: { "change": "modelChanged" }, modelChanged: function() { this.ui.flag.html("changed!"); } }); var view = new MyView({model: myModel}); view.render();