# HG changeset patch # User Marcin Kuzminski # Date 2013-02-25 22:16:36 # Node ID 07f4193083fdf54d8a89f87e609c89c3b7658bbf # Parent 58737dee17f12ab66ba4881d547a8584e104cf57 extra params in pyroutes now generate GET params diff --git a/rhodecode/public/js/rhodecode.js b/rhodecode/public/js/rhodecode.js --- a/rhodecode/public/js/rhodecode.js +++ b/rhodecode/public/js/rhodecode.js @@ -302,12 +302,25 @@ var pyroutes = (function() { } if (matchlist.hasOwnProperty(route_name)) { var route = matchlist[route_name]; + // param substitution for(var i=0; i < route[1].length; i++) { if (!params.hasOwnProperty(route[1][i])) throw new Error(route[1][i] + ' missing in "' + route_name + '" route generation'); } result = sprintf(route[0], params); + + var ret = []; + //extra params => GET + for(param in params){ + if (route[1].indexOf(param) == -1){ + ret.push(encodeURIComponent(param) + "=" + encodeURIComponent(params[param])); + } + } + var _parts = ret.join("&"); + if(_parts){ + result = result +'?'+ _parts + } } return result;