From bda613b136d3b946de63766989a3583f6d4bdeb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20renault?= Date: Sun, 16 Dec 2012 23:10:26 +0100 Subject: [PATCH] For put/post routes, give possibility to pass an object when using resolve --- src/simrou.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/simrou.coffee b/src/simrou.coffee index e881d16..b60c520 100644 --- a/src/simrou.coffee +++ b/src/simrou.coffee @@ -67,7 +67,7 @@ class Simrou @resolve(hash, 'get') # Resolves a hash. Method is optional, returns true if matching route found. - resolve: (hash, method) -> + resolve: (hash, method, data) -> # Strip unwanted characters from the hash cleanHash = String(hash).replace(@RegExpCache.trimHash, '$1') if cleanHash is '' @@ -85,9 +85,12 @@ class Simrou params = route.match(cleanHash) unless params continue - + # Prepend the arguments array with the method - args = [params, method] + if method in ['post', 'put'] + args = [params, method, data] + else + args = [params, method] # Trigger wildcard event $route = jQuery(route)