|
53 | 53 | /// <summary>Gets the parameters from a URL pattern.</summary> |
54 | 54 | /// <param name="pattern" mayBeNull="false" optional="false" type="String" parameterArray="false" integer="false" domElement="false">URL pattern defined by a route.</param> |
55 | 55 | /// <returns type="Array" integer="false" domElement="false" mayBeNull="false" elementType="String" elementInteger="false" elementDomElement="false" elementMayBeNull="false">All parameters of the route.</returns> |
56 | | - |
| 56 | + |
57 | 57 | var params = []; |
58 | 58 | $.each(pattern.match(constants.groupParameters) || [], function (i, param) { |
59 | 59 | params[i] = param.replace(constants.beginAndEndTag, ''); |
|
124 | 124 | /// <summary>Gets the route result for the given data values</summary> |
125 | 125 | /// <param name="data" mayBeNull="false" optional="false" type="Object" parameterArray="false" integer="false" domElement="false">Data used to format the route by replacing parameters in the route pattern with data values</param> |
126 | 126 | /// <returns type="RouteResult" integer="false" domElement="false" mayBeNull="false">Route value object with route URL</returns> |
127 | | - |
| 127 | + |
128 | 128 | for (var i = 0; i < this.routes.length; i++) { |
129 | 129 | if (this.routes[i].accept(data)) { |
130 | 130 | return this.routes[i].toResult(data); |
|
142 | 142 | if (!this.controllers[controller]) { |
143 | 143 | this.controllers[controller] = new Object(); |
144 | 144 | } |
145 | | - this.controllers[controller][action] = fn; |
| 145 | + |
| 146 | + if (this.controllers[controller][action]) { |
| 147 | + var startsWith = new RegExp('^' + action); |
| 148 | + var c = 0; |
| 149 | + $.each(this.controllers[controller], function (name, val) { |
| 150 | + if (startsWith.test(name)) { |
| 151 | + c++; |
| 152 | + } |
| 153 | + }); |
| 154 | + |
| 155 | + this.controllers[controller][action + c] = fn; |
| 156 | + } |
| 157 | + else { |
| 158 | + this.controllers[controller][action] = fn; |
| 159 | + } |
146 | 160 | } |
147 | 161 |
|
148 | 162 | this.namedAction = function (name, data) { |
|
164 | 178 |
|
165 | 179 | var _this = this; |
166 | 180 |
|
167 | | - this.constraints = []; |
| 181 | + this.constraints = []; |
168 | 182 |
|
169 | 183 | this.pattern = pattern; |
170 | |