!function(){var moduleFactory=function($){var module=this;$.require().script("mvc/controller","mvc/view").done(function(){var exports=function(){var URI=steal.URI||steal.File;$.Controller.getFolder=function(){return $.String.underscore(this.fullName.replace(/\./g,"/")).replace("/Controllers","")},$.Controller._calculatePosition=function(Class,view,action_name){var classParts=Class.fullName.split("."),classPartsWithoutPrefix=classParts.slice(0);classPartsWithoutPrefix.splice(0,2);var hasControllers=(classPartsWithoutPrefix.join("/"),classParts.length>2&&"Controllers"==classParts[1]),path=hasControllers?$.String.underscore(classParts[0]):$.String.underscore(classParts.join("/")),controller_name=$.String.underscore(classPartsWithoutPrefix.join("/")).toLowerCase(),suffix="string"==typeof view&&/\.[\w\d]+$/.test(view)?"":$.View.ext;
return"string"==typeof view?"//"==view.substr(0,2)||(view="//"+URI(path).join("views/"+(-1!==view.indexOf("/")?view:(hasControllers?controller_name+"/":"")+view))+suffix):view||(view="//"+URI(path).join("views/"+(hasControllers?controller_name+"/":"")+action_name.replace(/\.|#/g,"").replace(/ /g,"_"))+suffix),view};var calculateHelpers=function(myhelpers){var helpers={};if(myhelpers)if($.isArray(myhelpers))for(var h=0;h<myhelpers.length;h++)$.extend(helpers,myhelpers[h]);else $.extend(helpers,myhelpers);else{this._default_helpers&&(helpers=this._default_helpers);
for(var current=window,parts=this.constructor.fullName.split(/\./),i=0;i<parts.length;i++)current&&("object"==typeof current.Helpers&&$.extend(helpers,current.Helpers),current=current[parts[i]]);current&&"object"==typeof current.Helpers&&$.extend(helpers,current.Helpers),this._default_helpers=helpers}return helpers};$.Controller.prototype.view=function(view,data,myhelpers){"string"==typeof view||myhelpers||(myhelpers=data,data=view,view=null),view=$.Controller._calculatePosition(this.Class,view,this.called),data=data||this;
var helpers=calculateHelpers.call(this,myhelpers);return $.View(view,data,helpers)}};exports(),module.resolveWith(exports)})};dispatch("mvc/controller.view").containing(moduleFactory).to("Foundry/2.1 Modules")}();