Permalink
Browse files

allow a layout to be defined without regions, using underscore v1.4.x.

…fixes #270
  • Loading branch information...
derickbailey committed Oct 5, 2012
1 parent 2e8cfdc commit 204be093d8575a00d801ea8bee54e2cb0dbd6a68
Showing with 26 additions and 8 deletions.
  1. +10 −7 changelog.md
  2. +14 −0 spec/javascripts/layout.spec.js
  3. +2 −1 src/marionette.layout.js
View
@@ -15,6 +15,16 @@
* CompositeView
* **BREAKING:** CompositeView will only render a model in to it's template, instead of a model or collection. It will still render the collection as itemView instances.
+* CollectionView / CompositeView
+ * Cleaned up the `getItemViewContainer` code, and improved the error that is thrown when the specified container element is not found
+ * Can attach existing view instance w/ existing DOM element as child of collection view / composite view, in parent's `initialize` function
+
+* Layout
+ * Allow a Layout to be defined without `regions`, using Underscore v1.4.x
+
+* View / ItemView / CompositeView
+ * Removed the `serializeData` method and added directly to `ItemView` and `CompositeView` as needed
+
* Modules
* **BREAKING:** Split module definitions can now receive custom args per module definition, instead of sharing / replacing them across all definitions
@@ -28,13 +38,6 @@
* triggerMethod
* Added `Marionette.triggerMethod` method to trigger an event and call the corresponding method. For example, `view.triggetMethod("before:render")` will trigger the "before:render" event and call the `onBeforeRender` method.
-* View / ItemView / CompositeView
- * Removed the `serializeData` method and added directly to `ItemView` and `CompositeView` as needed
-
-* CollectionView / CompositeView
- * Cleaned up the `getItemViewContainer` code, and improved the error that is thrown when the specified container element is not found
- * Can attach existing view instance w/ existing DOM element as child of collection view / composite view, in parent's `initialize` function
-
* Misc
* jQuery ($) support now works from global `$` or `window.jQuery`
* Updated to Underscore.js v1.4.1
@@ -43,6 +43,20 @@ describe("layout", function(){
});
+ describe("on instantiation with no regions defined", function(){
+ var NoRegions = Marionette.Layout.extend({});
+ var layoutManager;
+
+ function init(){
+ layoutManager = new NoRegions();
+ };
+
+ it("should instantiate the specified region managers", function(){
+ expect(init).not.toThrow();
+ });
+
+ });
+
describe("on instantiation with custom region managers", function() {
var LayoutManagerCustomRegion = LayoutManager.extend({
regionType: CustomRegion1,
View
@@ -56,7 +56,8 @@ Marionette.Layout = Marionette.ItemView.extend({
}
var that = this;
- _.each(this.regions, function (region, name) {
+ var regions = this.regions || {};
+ _.each(regions, function (region, name) {
var regionManager = Marionette.Region.buildRegion(region, that.regionType);
regionManager.getEl = function(selector){

0 comments on commit 204be09

Please sign in to comment.