react-router-rails 0.13.3 → 0.13.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/react/router/rails/version.rb +1 -1
- data/lib/react/router/rails/view_helper.rb +2 -1
- data/vendor/assets/javascripts/react_router_ujs.js +11 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb0ce84079fef0b790477509c1ce1e5abb8ce5da
|
4
|
+
data.tar.gz: 1dec2b2b89c6881d297e744b72b92d8326049ce1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e12e1d4995676747a9b855d3bea2db9828cd13b5daf80cd7388970f369b7942e85b4f317b6968b8ac83c26e076b44734c361c0099526fb1eaeaeb3d9fb5a9940
|
7
|
+
data.tar.gz: 975b8d56ce26efe6e27ff960b3c1ba1ebe304826c42d824ff4c41bb854246a9e737d77cc718c0caa4d174c0400286691d1b7bae9adef0fde54ab815d5741eb68
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
1. Add to your `Gemfile` and install with bundler:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'react-router-rails', '~>0.13.3'
|
14
|
+
gem 'react-router-rails', '~>0.13.3.1'
|
15
15
|
```
|
16
16
|
|
17
17
|
```bash
|
@@ -98,8 +98,8 @@
|
|
98
98
|
|
99
99
|
This gem is highly inspired and based on [React Rails](https://github.com/reactjs/react-rails) code. Thanks!
|
100
100
|
|
101
|
-
A big thanks to [@troter](https://github.com/
|
101
|
+
A big thanks to [@troter](https://github.com/troter) who implemented the server-side rendering engine for this gem.
|
102
102
|
|
103
|
-
[React Router](https://github.com/rackt/react-router/) by [Ryan Florence](https://github.com/
|
103
|
+
[React Router](https://github.com/rackt/react-router/) by [Ryan Florence](https://github.com/ryanflorence), [Michael Jackson](https://github.com/mjackson) licensed under the [MIT license](https://github.com/rackt/react-router/blob/master/LICENSE)
|
104
104
|
|
105
105
|
Copyright [Mario Peixoto](https://github.com/mariopeixoto), released under the [MIT license](https://github.com/mariopeixoto/react-router-rails/LICENSE).
|
@@ -15,11 +15,12 @@ module React
|
|
15
15
|
html_options[:data].tap do |data|
|
16
16
|
data[:'react-router-class'] = routes
|
17
17
|
data[:'react-router-location'] = location
|
18
|
+
data[:'react-router-data'] = args.to_json
|
18
19
|
end
|
19
20
|
html_tag = html_options[:tag] || :div
|
20
21
|
|
21
22
|
html_options.except!(:tag, :prerender_location)
|
22
|
-
|
23
|
+
|
23
24
|
content_tag(html_tag, '', html_options, &block)
|
24
25
|
end
|
25
26
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
// Unobtrusive scripting adapter for React Router based on react-rails gem.
|
1
|
+
// Unobtrusive scripting adapter for React Router based on react-rails gem.
|
2
2
|
// https://github.com/reactjs/react-rails/blob/master/lib/assets/javascripts/react_ujs.js
|
3
3
|
(function(document, window, React, ReactRouter) {
|
4
4
|
var ROUTER_CLASS_NAME = 'data-react-router-class';
|
5
5
|
var LOCATION_CLASS_NAME = 'data-react-router-location';
|
6
|
+
var DATA_CLASS_NAME = 'data-react-router-data';
|
6
7
|
|
7
8
|
// jQuery is optional. Use it to support legacy browsers.
|
8
9
|
var $ = (typeof jQuery !== 'undefined') && jQuery;
|
@@ -20,10 +21,10 @@
|
|
20
21
|
var nodes = findReactRouterDOMNodes();
|
21
22
|
if (nodes.length >= 1) {
|
22
23
|
if (nodes.length > 1) {
|
23
|
-
console.warn('React Router is designed to have a single root router. ' + nodes.length + ' routers were found on the html. Using the first one.');
|
24
|
+
console.warn('React Router is designed to have a single root router. ' + nodes.length + ' routers were found on the html. Using the first one.');
|
24
25
|
}
|
25
26
|
var routerNode = nodes[0];
|
26
|
-
|
27
|
+
|
27
28
|
// Assume className is simple and can be found at top-level (window).
|
28
29
|
// Fallback to eval to handle cases like 'My.React.ComponentName'.
|
29
30
|
var className = routerNode.getAttribute(ROUTER_CLASS_NAME);
|
@@ -32,8 +33,11 @@
|
|
32
33
|
var locationName = routerNode.getAttribute(LOCATION_CLASS_NAME);
|
33
34
|
var location = ReactRouter[locationName] ;
|
34
35
|
|
36
|
+
var dataJson = routerNode.getAttribute(DATA_CLASS_NAME);
|
37
|
+
var data = JSON.parse(dataJson);
|
38
|
+
|
35
39
|
ReactRouter.run(routes, location, function (Handler) {
|
36
|
-
React.render(React.createElement(Handler), routerNode);
|
40
|
+
React.render(React.createElement(Handler, data), routerNode);
|
37
41
|
});
|
38
42
|
}
|
39
43
|
};
|
@@ -43,11 +47,11 @@
|
|
43
47
|
if ($) {
|
44
48
|
handleEvent = function(eventName, callback) {
|
45
49
|
$(document).on(eventName, callback);
|
46
|
-
}
|
50
|
+
};
|
47
51
|
} else {
|
48
52
|
handleEvent = function(eventName, callback) {
|
49
53
|
document.addEventListener(eventName, callback);
|
50
|
-
}
|
54
|
+
};
|
51
55
|
}
|
52
56
|
handleEvent('page:change', mountReactRouter);
|
53
57
|
};
|
@@ -66,4 +70,4 @@
|
|
66
70
|
handleNativeEvents();
|
67
71
|
}
|
68
72
|
|
69
|
-
})(document, window, React, ReactRouter);
|
73
|
+
})(document, window, React, ReactRouter);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react-router-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.13.3
|
4
|
+
version: 0.13.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Peixoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.4.
|
107
|
+
rubygems_version: 2.4.8
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: A gem for distribution of the react-router using the asset pipeline
|