// backbone.handlebars v0.2.1 // // Copyright (c) 2013 Loïc Frering // Distributed under the MIT license (function(){var e=Handlebars.JavaScriptCompiler.prototype.nameLookup;Handlebars.JavaScriptCompiler.prototype.nameLookup=function(t,n,r){return t+".get ? "+t+".get('"+n+"') : "+e.apply(this,arguments)};var t=Backbone.View.extend({render:function(){var e=this.context();_.isString(this.template)&&(this.template=Handlebars.compile(this.template,{knownHelpersOnly:!0}));if(_.isFunction(this.template)){var t=this.template(e,{data:{view:this}});this.$el.html(t)}return this.renderNestedViews(),this},renderNestedViews:function(){_.each(this.nestedViews,function(e,t){this.resolveViewClass(e.name,_.bind(function(n){this.renderNestedView(t,n,e.options)},this))},this)},renderNestedView:function(e,t,n){var r=this.$("#"+e);if(r.size()===1){var i=new t(n);r.replaceWith(i.$el),i.render()}},resolveViewClass:function(e,t){if(_.isFunction(e))return t(e);if(_.isString(e)){var n,r,i,s;n=e.split(".");for(r=0,i=n.length,s=window;r')}),Backbone.HandlebarsView=t})();