{"issue":{"state":"closed","created_at":"2011-10-14T15:10:46Z","updated_at":"2011-11-30T16:57:26Z","comments":27,"user":{"gravatar_id":"e9086a8466db2357a996e50a4b75e69e","id":455645,"url":"https://api.github.com/users/jhudson8","avatar_url":"https://secure.gravatar.com/avatar/e9086a8466db2357a996e50a4b75e69e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jhudson8"},"body":"Query string route syntax\r\n==================\r\nAny route except those ending with a wildcard will automatically accept additional content using the '?' separator.  This content is a set of key value pairs using '&' as the pair separator and '=' as the key/value separator - just like the URL query string syntax.\r\n\r\nIf a query string exists in the route hash, the routing function (defined in the routes hash) will be given an additional parameter (in last ordinal position) containing hash of the key/value data.\r\n\r\n  routes: {\r\n    'foo/:bar': 'myRoute'\r\n  }\r\n  ...\r\n  myRoute: function(bar, params) {\r\n    // the params attribute will be undefined unless there is a route containing a query string\r\n  }\r\n\r\nExample route patterns\r\n\r\n  #foo/abc -> myRoute( 'abc', undefined )\r\n\r\n  #foo/abc?foo=bar -> myRoute( 'abc', {'foo': 'bar'} )\r\n\r\n\r\nNested query string Keys\r\n------------------------------------\r\nAny keys containing '.' will represent a nested structure.\r\n\r\n  #foo/abc?me.fname=Joe&me.lname=Hudson -> myRoute('abc', {'me': {'fname': 'Joe', 'lname': 'Hudson'}} )\r\n\r\n\r\nQuery string value arrays\r\n------------------------------------\r\nAny values containing '|' will assume an array structure.  Note: you can still have non-array values containing '|' but it must be URI encoded (%7C).\r\n\r\nYou can prefix the value with '|' to ensure an array in case there is only a single value.\r\n\r\n  #foo/abc?animals=cat|dog -> myRoute( 'abc', ['cat', 'dog'] )\r\n\r\n  #foo/abc?animals=|cat -> myRoute( 'abc', ['cat'] )\r\n\r\n\r\nGenerating route with query string=========================\r\n\r\nYou can easily create a route string from a route + parameter hash using the router.toFragment(route, parameters) method.  It can contain a nested hash structure or arrays.  ex:\r\n     var route = router.toFragment('myroute', {\r\n        a:'l', b:{c: 'n', d:'m', e:{f: 'o'}}, array1:['p'], array2:['q', 'r'], array3:['s','t','|']\r\n    });\r\n\r\nParameter-based URI decoding\r\n=======================\r\nCurrent backbone will decode the complete hash value.  This requires route parameters to be encoded multiple times if they contain reserved characters ('/' for example).\r\n\r\nThis patch moves all decoding to route parameters when they are in parameter form (after the hash has been parsed).","assignee":null,"id":1911292,"pull_request":{"patch_url":"https://github.com/documentcloud/backbone/pull/668.patch","html_url":"https://github.com/documentcloud/backbone/pull/668","diff_url":"https://github.com/documentcloud/backbone/pull/668.diff"},"labels":[],"number":668,"title":"query string route syntax & parameter-based URI decoding","closed_at":"2011-11-30T15:27:02Z","html_url":"https://github.com/documentcloud/backbone/issues/668","url":"https://api.github.com/repos/documentcloud/backbone/issues/668","milestone":{"state":"open","created_at":"2011-10-13T01:26:40Z","closed_issues":6,"due_on":null,"creator":{"gravatar_id":"21dbcdbf46f8ee3774c1b9b3efadfa9e","id":181635,"url":"https://api.github.com/users/tbranyen","avatar_url":"https://secure.gravatar.com/avatar/21dbcdbf46f8ee3774c1b9b3efadfa9e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"tbranyen"},"number":4,"description":"Issues and pull requests that relate to routing.","title":"Router","url":"https://api.github.com/repos/documentcloud/backbone/milestones/4","open_issues":6}},"action":"created","comment":{"created_at":"2011-11-30T16:57:26Z","updated_at":"2011-11-30T16:57:26Z","user":{"gravatar_id":"e9086a8466db2357a996e50a4b75e69e","id":455645,"url":"https://api.github.com/users/jhudson8","avatar_url":"https://secure.gravatar.com/avatar/e9086a8466db2357a996e50a4b75e69e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"jhudson8"},"body":"<blush>thanks</blush>","id":2962502,"url":"https://api.github.com/repos/documentcloud/backbone/issues/comments/2962502"}}