Skip to content
This repository
Browse code

version bump to 0.6.4

  • Loading branch information...
commit 35bb09175644b9cd9caf86b10a6453fc748f16b7 1 parent 02cb021
Tim Branyen authored August 16, 2012
2  backbone.layoutmanager.js
... ...
@@ -1,5 +1,5 @@
1 1
 /*!
2  
- * backbone.layoutmanager.js v0.6.3
  2
+ * backbone.layoutmanager.js v0.6.4
3 3
  * Copyright 2012, Tim Branyen (@tbranyen)
4 4
  * backbone.layoutmanager.js may be freely distributed under the MIT license.
5 5
  */
8  changelog.md
Source Rendered
... ...
@@ -1,3 +1,11 @@
  1
+### 0.6.3 ###
  2
+
  3
+* Fixed a memory leak that existed with appended Views
  4
+* Updated all examples
  5
+* Fixed regression with events being bound to Layouts
  6
+* General performance tweaks
  7
+* Updated cheerio dependency to 0.9.2 for the Node implementation
  8
+
1 9
 ### 0.6.2 ###
2 10
 
3 11
 * Updated to support jQuery 1.8
4  dist/backbone.layoutmanager.min.js
... ...
@@ -1,6 +1,6 @@
1 1
 /*!
2  
- * backbone.layoutmanager.js v0.6.3
  2
+ * backbone.layoutmanager.js v0.6.4
3 3
  * Copyright 2012, Tim Branyen (@tbranyen)
4 4
  * backbone.layoutmanager.js may be freely distributed under the MIT license.
5 5
  */
6  
-(function(a){"use strict";var b,c=a.Backbone,d=a._,e=a.$,f=c.View.prototype._configure,g=c.View.prototype.render,h=c.View.extend({constructor:function(a){a=a||{},h.setupView(this,a),c.View.call(this,a)},swapLayout:function(a){return a.views=d.defaults({},this.views,a.views),a.setElement(this.el),a},insertView:function(a,b){return b?this.setView(a,b,!0):this.setView(a,!0)},insertViews:function(a){return d.each(a,function(b,c){a[c]=[].concat(b)}),this.setViews(a)},getView:function(a){return this.getViews(a).first().value()},getViews:function(a){var b=d.chain(this.views).map(function(a){return[].concat(a)},this).flatten().value();return d.chain(d.filter(b,a?a:d.identity))},setView:function(a,b,c){var e,f,g=this;return d.isString(a)||(c=b,b=a,a=""),this.views=this.views||{},!c&&this.views[a]&&(d.isArray(this.views[a])?d.each(this.views[a],function(a){a.remove()}):this.views[a].remove()),f=b._options(),b.__manager__||h.setupView(b,f),b.render=function(e){function j(){(!c||!b.__manager__.hasRendered)&&f.partial(g.el,a,b.el,c)&&(b.__manager__.hasRendered=!0),b.delegateEvents(),b.__manager__.handler&&(b.__manager__.handler.resolveWith(b,[b.el]),delete b.__manager__.handler),i.resolveWith(b,[b.el]),d.isFunction(e)&&e.call(b,b.el)}var i=f.deferred();return b.__manager__.viewDeferred=i,b._removeView(),h.prototype.render.call(b).then(j),i.promise()},b.__manager__.parent=g,b.__manager__.selector=a,c?(e=this.views[a]=this.views[a]||[],d.isArray(this.views[a])||(e=this.views[a]=[this.views[a]]),d.indexOf(e,b)>-1?b:(e.push(b),b.__manager__.append=!0,b)):this.views[a]=b},setViews:function(a){return d.each(a,function(a,b){if(d.isArray(a))return d.each(a,function(a){this.insertView(b,a)},this);this.setView(b,a)},this),this},render:function(a){var b=this,c=this._options(),e=c.deferred();return this.__manager__.renderDeferred?(this.__manager__.callback=a,this.__manager__.renderDeferred):(this._render(h._viewRender).fetch.then(function(){b.__manager__.renderDeferred=e;var a=d.map(b.views,function(a){function e(a,b){if(!a.length)return b();var c=a.shift();c.render(function(){e(a,b)})}var b;return d.isArray(a)?(b=c.deferred(),e(d.clone(a),function(){b.resolve()}),b.promise()):a.render()});c.when(a).then(function(){e.resolveWith(b,[b.el])})}),e.then(function(){d.isFunction(a)&&a.call(b,b.el),b.__manager__.handler&&(b.__manager__.handler.resolveWith(b,[b.el]),delete b.__manager__.handler),d.isFunction(b.__manager__.callback)&&(b.__manager__.callback.call(b,b.el),delete b.__manager__.callback),delete b.__manager__.renderDeferred}))},remove:function(){return h.cleanViews(this),this._remove.apply(this,arguments)},_options:function(){return d.extend({},this,h.prototype.options,this.options)}},{_cache:{},_makeAsync:function(a,b){var c=a.deferred();return c.async=function(){return c._isAsync=!0,b},c},_viewRender:function(a){function g(c,d){h.cache(b,d),d&&f.html(a.el,f.render(d,c)),e.fetch.resolveWith(a,[a.el])}var b,c,e,f=a._options();return{render:function(i){var j=a.__manager__,k=a.template||f.template;return a.serialize&&(f.serialize=a.serialize),!i&&d.isFunction(f.serialize)?i=f.serialize.call(a):!i&&d.isObject(f.serialize)&&(i=f.serialize),e=h._makeAsync(f,d.bind(g,a,i)),e.fetch=f.deferred(),j.handler=e,d.isString(k)&&(b=j.prefix+k),(c=h.cache(b))?(g(i,c,b),e):(d.isString(k)?c=f.fetch.call(e,j.prefix+k):k!=null&&(c=f.fetch.call(e,k)),e._isAsync||g(i,c),e)}}},cleanViews:function(a){d.each([].concat(a),function(a){a.unbind(),a.views&&d.each(a.views,function(a){h.cleanViews(a)}),d.isFunction(a.cleanup)&&a.cleanup.call(a)})},cache:function(a,b){if(a in this._cache)return this._cache[a];if(a!=null&&b!=null)return this._cache[a]=b},configure:function(a){d.extend(h.prototype.options,a),a.manage&&(c.View.prototype.manage=!0)},setupView:function(a,e){var f,g,i=c.LayoutManager.prototype,j=d.pick(a,b);if(a.__manager__)return;d.defaults(a,{views:{},__manager__:{},_options:h.prototype._options,_removeView:h._removeView}),a instanceof c.Layout?a.__manager__.prefix=a._options().paths.layout||"":a.__manager__.prefix=a._options().paths.template||"",e=a.options=d.defaults(e||{},a.options,i.options),g=d.pick(e,["events"].concat(d.values(e.events))),d.extend(a,g),delete j.render,d.extend(e,j),a._remove=c.View.prototype.remove,a._render=function(a){var b,c=this._options().beforeRender,e=this._options().afterRender;return this._removeView(),d.isFunction(c)&&c.call(this,this),this.trigger("beforeRender",this),b=a(this).render(),b.then(function(){var a=this,b=a.__manager__.parent,c=function(){a.delegateEvents(),d.isFunction(e)&&e.call(a,a),a.trigger("afterRender",a)},f=function(a){var b=a.__manager__;return b.parent&&!b.hasRendered?f(b.parent):a};if(!b)return c.call(a);a.__manager__.hasRendered&&a.__manager__.viewDeferred.then(function(){c.call(a)}),b=f(a),b.on("afterRender",function(){b.off(null,null,a),c.call(a)},a)}),b},a.render=h.prototype.render,a.remove!==i.remove&&(a._remove=a.remove,a.remove=i.remove),f=e.views||a.views,d.keys(f).length&&a.setViews(f),a.template&&(e.template=a.template,delete a.template)},_removeView:function(a){a=a||this,a.getViews().each(function(a){var b=a.__manager__,c=d.isBoolean(a.keep)?a.keep:a.options.keep;if(!c&&b.append===!0&&b.hasRendered){a.remove();if(d.isArray(b.parent.views[b.selector]))return b.parent.getView(function(a,c){a.__manager__.selector===b.selector&&b.parent.views[b.selector].splice(c,1)});delete b.parent[b.selector]}})}});d.each(["get","set","insert"],function(a){var b=c.View.prototype,d=h.prototype;b[a+"View"]=d[a+"View"],b[a+"Views"]=d[a+"Views"]}),c.Layout=c.LayoutManager=h,c.LayoutView=c.View.extend({manage:!0}),c.View.prototype._configure=function(){var a=f.apply(this,arguments);return this.manage&&h.setupView(this),a},h.prototype.options={paths:{},deferred:function(){return e.Deferred()},fetch:function(a){return d.template(e(a).html())},partial:function(a,b,c,d){var f=b?e(a).find(b):e(a);return f.length?(this[d?"append":"html"](f,c),!0):!1},html:function(a,b){e(a).html(b)},append:function(a,b){e(a).append(b)},when:function(a){return e.when.apply(null,a)},render:function(a,b){return a(b)}},b=d.keys(h.prototype.options)})(this);
  6
+(function(a){"use strict";var b,c=a.Backbone,d=a._,e=a.$,f=c.View.prototype._configure,g=c.View.prototype.render,h=c.View.extend({constructor:function(a){a=a||{},h.setupView(this,a),c.View.call(this,a)},swapLayout:function(a){return a.views=d.defaults({},this.views,a.views),a.setElement(this.el),a},insertView:function(a,b){return b?this.setView(a,b,!0):this.setView(a,!0)},insertViews:function(a){return d.each(a,function(b,c){a[c]=[].concat(b)}),this.setViews(a)},getView:function(a){return this.getViews(a).first().value()},getViews:function(a){var b=d.chain(this.views).map(function(a){return[].concat(a)},this).flatten().value();return d.chain(d.filter(b,a?a:d.identity))},setView:function(a,b,c){var e,f,g=this;return d.isString(a)||(c=b,b=a,a=""),this.views=this.views||{},!c&&this.views[a]&&(d.isArray(this.views[a])?d.each(this.views[a],function(a){a.remove()}):this.views[a].remove()),f=b._options(),b.__manager__||h.setupView(b,f),b.render=function(e){function j(){(!c||!b.__manager__.hasRendered)&&f.partial(g.el,a,b.el,c)&&(b.__manager__.hasRendered=!0),b.delegateEvents(),b.__manager__.handler&&(b.__manager__.handler.resolveWith(b,[b.el]),delete b.__manager__.handler),i.resolveWith(b,[b.el]),d.isFunction(e)&&e.call(b,b.el)}var i=f.deferred();return b.__manager__.viewDeferred=i,b._removeView(),h.prototype.render.call(b).then(j),i.promise()},b.__manager__.parent=g,b.__manager__.selector=a,c?(e=this.views[a]=this.views[a]||[],d.isArray(this.views[a])||(e=this.views[a]=[this.views[a]]),d.indexOf(e,b)>-1?b:(e.push(b),b.__manager__.append=!0,b)):this.views[a]=b},setViews:function(a){return d.each(a,function(a,b){if(d.isArray(a))return d.each(a,function(a){this.insertView(b,a)},this);this.setView(b,a)},this),this},render:function(a){var b=this,c=this._options(),e=c.deferred();return this.__manager__.renderDeferred?(this.__manager__.callback=a,this.__manager__.renderDeferred):(this._render(h._viewRender).fetch.then(function(){b.__manager__.renderDeferred=e;var a=d.map(b.views,function(a){function e(a,b){if(!a.length)return b();var c=a.shift();c.render(function(){e(a,b)})}var b;return d.isArray(a)?(b=c.deferred(),e(d.clone(a),function(){b.resolve()}),b.promise()):a.render()});c.when(a).then(function(){e.resolveWith(b,[b.el])})}),e.then(function(){d.isFunction(a)&&a.call(b,b.el),b.__manager__.handler&&(b.__manager__.handler.resolveWith(b,[b.el]),delete b.__manager__.handler),d.isFunction(b.__manager__.callback)&&(b.__manager__.callback.call(b,b.el),delete b.__manager__.callback),delete b.__manager__.renderDeferred}))},remove:function(){return h.cleanViews(this),this._remove.apply(this,arguments)},_options:function(){return d.extend({},this,h.prototype.options,this.options)}},{_cache:{},_makeAsync:function(a,b){var c=a.deferred();return c.async=function(){return c._isAsync=!0,b},c},_viewRender:function(a){function g(c,d){h.cache(b,d),d&&f.html(a.el,f.render(d,c)),e.fetch.resolveWith(a,[a.el])}var b,c,e,f=a._options();return{render:function(i){var j=a.__manager__,k=a.template||f.template;return a.serialize&&(f.serialize=a.serialize),!i&&d.isFunction(f.serialize)?i=f.serialize.call(a):!i&&d.isObject(f.serialize)&&(i=f.serialize),e=h._makeAsync(f,d.bind(g,a,i)),e.fetch=f.deferred(),j.handler=e,d.isString(k)&&(b=j.prefix+k),(c=h.cache(b))?(g(i,c,b),e):(d.isString(k)?c=f.fetch.call(e,j.prefix+k):k!=null&&(c=f.fetch.call(e,k)),e._isAsync||g(i,c),e)}}},cleanViews:function(a){d.each([].concat(a),function(a){a.unbind(),a.views&&d.each(a.views,function(a){h.cleanViews(a)}),d.isFunction(a.cleanup)&&a.cleanup.call(a)})},cache:function(a,b){if(a in this._cache)return this._cache[a];if(a!=null&&b!=null)return this._cache[a]=b},configure:function(a){d.extend(h.prototype.options,a),a.manage&&(c.View.prototype.manage=!0)},setupView:function(a,e){var f,g,i=c.LayoutManager.prototype,j=d.pick(a,b);if(a.__manager__)return;d.defaults(a,{views:{},__manager__:{},_options:h.prototype._options,_removeView:h._removeView}),a instanceof c.Layout?a.__manager__.prefix=a._options().paths.layout||"":a.__manager__.prefix=a._options().paths.template||"",e=a.options=d.defaults(e||{},a.options,i.options),g=d.pick(e,["events"].concat(d.values(e.events))),d.extend(a,g),delete j.render,d.extend(e,j),a._remove=c.View.prototype.remove,a._render=function(a){var b,c=this._options().beforeRender,e=this._options().afterRender;return this._removeView(),d.isFunction(c)&&c.call(this,this),this.trigger("beforeRender",this),b=a(this).render(),b.then(function(){var a=this,b=a.__manager__.parent,c=function(){a.delegateEvents(),d.isFunction(e)&&e.call(a,a),a.trigger("afterRender",a)},f=function(a){var b=a.__manager__;return b.parent&&!b.hasRendered?f(b.parent):a};if(!b)return c.call(a);if(a.__manager__.viewDeferred)return a.__manager__.viewDeferred.then(function(){c.call(a)});b=f(a),b.on("afterRender",function(){b.off(null,null,a),c.call(a)},a)}),b},a.render=h.prototype.render,a.remove!==i.remove&&(a._remove=a.remove,a.remove=i.remove),f=e.views||a.views,d.keys(f).length&&a.setViews(f),a.template&&(e.template=a.template,delete a.template)},_removeView:function(a){a=a||this,a.getViews().each(function(a){var b=a.__manager__,c=d.isBoolean(a.keep)?a.keep:a.options.keep;if(!c&&b.append===!0&&b.hasRendered){a.remove();if(d.isArray(b.parent.views[b.selector]))return b.parent.getView(function(a,c){a.__manager__.selector===b.selector&&b.parent.views[b.selector].splice(c,1)});delete b.parent[b.selector]}})}});d.each(["get","set","insert"],function(a){var b=c.View.prototype,d=h.prototype;b[a+"View"]=d[a+"View"],b[a+"Views"]=d[a+"Views"]}),c.Layout=c.LayoutManager=h,c.LayoutView=c.View.extend({manage:!0}),c.View.prototype._configure=function(){var a=f.apply(this,arguments);return this.manage&&h.setupView(this),a},h.prototype.options={paths:{},deferred:function(){return e.Deferred()},fetch:function(a){return d.template(e(a).html())},partial:function(a,b,c,d){var f=b?e(a).find(b):e(a);return f.length?(this[d?"append":"html"](f,c),!0):!1},html:function(a,b){e(a).html(b)},append:function(a,b){e(a).append(b)},when:function(a){return e.when.apply(null,a)},render:function(a,b){return a(b)}},b=d.keys(h.prototype.options)})(this);
2  package.json
@@ -2,7 +2,7 @@
2 2
   "author": "Tim Branyen (@tbranyen)",
3 3
   "name": "backbone.layoutmanager",
4 4
   "description": "A manager for templates & layouts in Backbone.js",
5  
-  "version": "0.6.3",
  5
+  "version": "0.6.4",
6 6
   "homepage": "http://tbranyen.github.com/backbone.layoutmanager/",
7 7
   "repository": {
8 8
     "type": "git",
7  readme.md
Source Rendered
@@ -844,11 +844,8 @@ Backbone.LayoutManager.configure({
844 844
 
845 845
 ## Release notes ##
846 846
 
847  
-### 0.6.3 ###
  847
+### 0.6.4 ###
848 848
 
849  
-* Fixed a memory leak that existed with appended Views
850  
-* Updated all examples
851  
-* Fixed regression with events being bound to Layouts
852  
-* General performance tweaks
  849
+* Fixed regression with `afterRender`
853 850
 
854 851
 [Full Release Log](https://github.com/tbranyen/backbone.layoutmanager/blob/master/changelog.md)

0 notes on commit 35bb091

Please sign in to comment.
Something went wrong with that request. Please try again.