Regenerated routes-min.js with new '_path' postfix to routes
This commit is contained in:
parent
984317e4fc
commit
46802f5085
2
lib/javascripts/routes-min.js
vendored
2
lib/javascripts/routes-min.js
vendored
|
@ -10,7 +10,7 @@ if(!options.includeSlash&&path.match(/.+\/$/)){path=path.slice(0,-1);}
|
|||
if(!options.onlyPath){var portString=options.port?':'+options.port:'';path=[options.protocol,options.host,portString,path].join('')}
|
||||
var leftOvers=[];iterate(params,function(k,v){leftOvers.push(k+'='+v);});if(leftOvers.length>0){path=path+'?'+leftOvers.join('&');}
|
||||
if(options.escape){path=encodeURI(path);}
|
||||
return path;},toString:function(){return this.segments.join('');}};Route.Segment=function(value,type,optional){this.value=value;this.type=type||'static';this.optional=(typeof optional==='boolean'?optional:true);};Route.Segment.prototype={isDynamic:function(){return this.type==='dynamic'||this.type==='path';},toString:function(){if(this.type==='dynamic'){return':'+this.value;}else if(this.type==='path'){return'*'+this.value;}else{return this.value;}},equal:function(other){return other.constructor===this.constructor&&other.value===this.value&&other.type===this.type&&other.optional===this.optional;}};Route.createSegment=function(s,optional){if(s.match(/^[\/;?.]$/)){return new Route.Segment(s,'divider',optional);}else if(s.indexOf(':')===0){return new Route.Segment(s.slice(1),'dynamic',optional);}else if(s.indexOf('*')===0){return new Route.Segment(s.slice(1),'path',optional);}else{return new Route.Segment(s,'static',optional);}};Route.S=Route.createSegment;var Routes=[];Routes.named=[];Routes.defaultParams={action:'index'};Routes.defaultOptions={escape:true,port:window.location.port,protocol:window.location.protocol+'//',host:window.location.hostname};Routes.extractNamed=function(){var route;for(var i=0;i<this.length;i++){route=this[i];if(route.name){this.named.push(route);this.named[route.name]=route;this[route.name]=(function(route){var fn=function(){var params={},options={},count;for(var p in route.params){if(route.params.hasOwnProperty(p)&&route.params[p].constructor!==RegExp){params[p]=route.params[p];}}
|
||||
return path;},toString:function(){return this.segments.join('');}};Route.Segment=function(value,type,optional){this.value=value;this.type=type||'static';this.optional=(typeof optional==='boolean'?optional:true);};Route.Segment.prototype={isDynamic:function(){return this.type==='dynamic'||this.type==='path';},toString:function(){if(this.type==='dynamic'){return':'+this.value;}else if(this.type==='path'){return'*'+this.value;}else{return this.value;}},equal:function(other){return other.constructor===this.constructor&&other.value===this.value&&other.type===this.type&&other.optional===this.optional;}};Route.createSegment=function(s,optional){if(s.match(/^[\/;?.]$/)){return new Route.Segment(s,'divider',optional);}else if(s.indexOf(':')===0){return new Route.Segment(s.slice(1),'dynamic',optional);}else if(s.indexOf('*')===0){return new Route.Segment(s.slice(1),'path',optional);}else{return new Route.Segment(s,'static',optional);}};Route.S=Route.createSegment;var Routes=[];Routes.named=[];Routes.defaultParams={action:'index'};Routes.defaultOptions={escape:true,port:window.location.port,protocol:window.location.protocol+'//',host:window.location.hostname};Routes.extractNamed=function(){var route;for(var i=0;i<this.length;i++){route=this[i];if(route.name){this.named.push(route);this.named[route.name]=route;this[route.name+'_path']=(function(route){var fn=function(){var params={},options={},count;for(var p in route.params){if(route.params.hasOwnProperty(p)&&route.params[p].constructor!==RegExp){params[p]=route.params[p];}}
|
||||
if(typeof arguments[0]==='object'&&!(arguments[0]instanceof Array)){extend(params,arguments[0]);options=arguments[1];}else{if(typeof arguments[arguments.length-1]==='object'){options=arguments[arguments.length-1];}
|
||||
var count=0;for(var i=0;i<route.segments.length;i++){if(route.segments[i].isDynamic()){if(arguments.length>count){params[route.segments[i].value]=arguments[count];}
|
||||
count++;}}}
|
||||
|
|
Loading…
Reference in a new issue