rails-routes-js-utils 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,12 @@ function addRouteToEnv(obj) {
5
5
  window.Routes[obj.name+'_path'] = function(idOrObject){
6
6
  if (typeof idOrObject == 'object')
7
7
  return obj.replace(idOrObject);
8
- return obj.replace({id: idOrObject});
8
+ var param= {};
9
+ for (var i=0;i<obj.reqs.parts.length;i++) {
10
+ param[obj.reqs.parts[i]] = arguments[i];
11
+ }
12
+ return obj.replace(param);
9
13
  };
10
14
  window.AllRoutes.push({path: obj.path,reqs: obj.reqs});
11
15
  }
12
-
13
- addRouteToEnv({name: 'brand_root', path: /^\/$/ , reqs: {"controller":"brand/stores","action":"index","parts":[]}, replace: function(opts) { return '/'; }})
14
-
15
16
  <%= Rails::Routes::Js::Utils.generate %>
@@ -35,6 +35,9 @@ module Rails
35
35
  all_routes.routes.collect do |route|
36
36
  compiled_regex = route.path.to_regexp.to_javascript
37
37
  reqs = route.defaults.merge(parts: route.parts)
38
+ if route.constraints[:subdomain]
39
+ reqs = reqs.merge(subdomain: route.constraints[:subdomain].to_javascript)
40
+ end
38
41
 
39
42
  js = [];
40
43
  dig(route.path.spec,js)
@@ -2,7 +2,7 @@ module Rails
2
2
  module Routes
3
3
  module Js
4
4
  module Utils
5
- VERSION = "1.0.5"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-routes-js-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-11 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails