react_on_rails 5.0.0.rc.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/KUDOS.md +14 -0
- data/PROJECTS.md +1 -0
- data/README.md +20 -26
- data/lib/react_on_rails/version.rb +1 -1
- data/package.json +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec359c1e0f84518176fe7da146462db339840dab
|
4
|
+
data.tar.gz: 6c7254b25df83c0901bfbf6d6191ae30d4a5aaf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 107de36a62e7465ddaf93a1b60a0a79da9550b68fe02de5d61b98cc8b140451fbc9d6401fde524d65d74e7162baa10a25644d27d55df91417ea7a4fd4e9c7ee3
|
7
|
+
data.tar.gz: 345f0a9e9617c7235e5f15db7144d192c51a49c9f5786b2cb33e6103eb75731518a4e74f98dc59edce783a776a47b333ce8c2b0314fb83c80c432b697b4ef082
|
data/CHANGELOG.md
CHANGED
@@ -13,7 +13,7 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
|
|
13
13
|
- Previously, you could pass arbitrary additional html attributes to react_component. Now, you need to pass them in as a named parameter `html_options` to react_component.
|
14
14
|
|
15
15
|
##### Breaking Changes
|
16
|
-
- You must provide named attributes, including `props` for view helper `react_compnent`.
|
16
|
+
- You must provide named attributes, including `props` for view helper `react_compnent`. See [this commit]](https://github.com/shakacode/react-webpack-rails-tutorial/commit/a97fa90042cbe27be7fd7fa70b5622bfcf9c3673) for an example migration used for [www.reactrails.com](http://www.reactrails.com).
|
17
17
|
|
18
18
|
## [4.0.3] - 2016-03-17
|
19
19
|
|
data/KUDOS.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
This is a sibling file to [PROJECTS.md](./PROJECTS.md).
|
2
|
+
|
3
|
+
I'm looking for quotes on why you like using React on Rails. You might mention any benefits you particularly like and if you've migrated from react-rails. Just click to edit and github will automatically open up a PR. Thanks to everybody that contributes!
|
4
|
+
|
5
|
+
> Gone are the days of using bower or rails gems to manage front end dependencies! React on Rails provides webpack integration to give us a modern build process, es6 syntax and the entire npm ecosystem of libraries to use, along with view helpers to make React integration with Rails feel better than a cool summer breeze. - [@kalamyty](https://twitter.com/kalamyty)
|
6
|
+
|
7
|
+
### Compared to Browserify
|
8
|
+
See comments [here](https://lorefnon.me/2015/11/15/a-minimal-setup-for-using-es6-modules-in-rails.html)
|
9
|
+
|
10
|
+
![2016-03-23_16-24-51](https://cloud.githubusercontent.com/assets/1118459/14006786/ebf8cac2-f114-11e5-80f9-4a6d437dd071.png)
|
11
|
+
|
12
|
+
https://twitter.com/ollieglass/status/713372606804729856
|
13
|
+
|
14
|
+
![2016-03-25_07-40-01](https://cloud.githubusercontent.com/assets/1118459/14053652/d05480f0-f276-11e5-9d9a-62d1146cd82d.png)
|
data/PROJECTS.md
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
* **Friends and Guests**, the signature product of [ShakaCode](http://www.shakacode.com), which is a "Social Network Connecting Hosts and Guests". *Coming soon!*
|
9
9
|
* **[Madrone Analytics](http://madroneco.com/)**: The original client of [ShakaCode](http://www.shakacode.com) that led to the development of React on Rails, as described in [Fast Rich Client Rails Development With Webpack and the ES6 Transpiler](http://www.railsonmaui.com/blog/2014/10/03/integrating-webpack-and-the-es6-transpiler-into-an-existing-rails-project/).
|
10
10
|
* **[Pivotal Tracker](http://www.pivotaltracker.com/)**: The first (and most-loved) agile project management tool built on Rails. React on Rails has greatly simplified integration and workflow for our React components in Rails!
|
11
|
+
* **[Confident Financial Solutions](https://www.mycfsapp.com/)**: Auto Repair Financing to help people get back on the road and back to life.
|
11
12
|
|
12
13
|
--------
|
13
14
|
|
data/README.md
CHANGED
@@ -1,16 +1,10 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/shakacode/react_on_rails.svg?branch=master)](https://travis-ci.org/shakacode/react_on_rails) [![Dependency Status](https://gemnasium.com/shakacode/react_on_rails.svg)](https://gemnasium.com/shakacode/react_on_rails) [![Gem Version](https://badge.fury.io/rb/react_on_rails.svg)](https://badge.fury.io/rb/react_on_rails) [![npm version](https://badge.fury.io/js/react-on-rails.svg)](https://badge.fury.io/js/react-on-rails) [![Code Climate](https://codeclimate.com/github/shakacode/react_on_rails/badges/gpa.svg)](https://codeclimate.com/github/shakacode/react_on_rails) [![Coverage Status](https://coveralls.io/repos/shakacode/react_on_rails/badge.svg?branch=master&service=github)](https://coveralls.io/github/shakacode/react_on_rails?branch=master)
|
2
2
|
|
3
3
|
# NEWS
|
4
|
+
* 5.0.0.rc.1 has shipped! Please let me know if you're tried it and if you like the changes.
|
5
|
+
* Please see the [CHANGELOG.md](./CHANGELOG.md) for details on the latest release and any breaking changes.
|
4
6
|
* [New slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032).
|
5
|
-
*
|
6
|
-
* 2016-03-17: **4.0.3** Shipped! Includes using the new Heroku buildpack steps, several smaller changes detailed in the [CHANGELOG.md](./CHANGELOG.md).
|
7
|
-
* 2016-03-14: **4.0.0** Highlights
|
8
|
-
* Better support for hot reloading of assets from Rails with new helpers and updates to the sample testing app, [spec/dummy](spec/dummy).
|
9
|
-
* Better support for Turbolinks 5.
|
10
|
-
* Controller rendering of shared redux stores and ability to render store data at bottom of HTML page.
|
11
|
-
* See [#311](https://github.com/shakacode/react_on_rails/pull/311/files).
|
12
|
-
* Some breaking changes! See [CHANGELOG.md](./CHANGELOG.md) for details.
|
13
|
-
* 2016-02-28: We added a [Projects page](PROJECTS.md). Please edit the page your project or [email us](mailto:contact@shakacode.com) and we'll add you. We also love stars as it helps us attract new users and contributors. [jbhatab](https://github.com/jbhatab) is leading an effort to ease the onboarding process for newbies with simpler project generators. See [#245](https://github.com/shakacode/react_on_rails/issues/245).
|
7
|
+
* 2016-02-28: We added a [Projects page](PROJECTS.md). Please edit the page your project or [email us](mailto:contact@shakacode.com) and we'll add you. We also love stars as it helps us attract new users and contributors.
|
14
8
|
* *See [NEWS.md](NEWS.md) for the full news history.*
|
15
9
|
|
16
10
|
# NOTES
|
@@ -28,7 +22,7 @@ Be sure to see:
|
|
28
22
|
* [React on Rails, Slides](http://www.slideshare.net/justingordon/react-on-rails-v4032)
|
29
23
|
* [The React on Rails Doctrine](https://medium.com/@railsonmaui/the-react-on-rails-doctrine-3c59a778c724)
|
30
24
|
* [React Webpack Rails Tutorial Code](https://github.com/shakacode/react-webpack-rails-tutorial) along with the live example at [www.reactrails.com](http://www.reactrails.com).
|
31
|
-
* [Projects](PROJECTS.md) using React on Rails. Please submit yours!
|
25
|
+
* [Projects](PROJECTS.md) using and [KUDOS](./KUDOS.md) for React on Rails. Please submit yours!
|
32
26
|
* On Twitter, follow [@railsonmaui](https://twitter.com/railsonmaui) and [@shakacode](https://twitter.com/shakacode) for updates on releases.
|
33
27
|
|
34
28
|
## Including your React Component in your Rails Views
|
@@ -77,7 +71,7 @@ Please see [Getting Started](#getting-started) for how to set up your Rails proj
|
|
77
71
|
+ [How it Works](#how-it-works)
|
78
72
|
- [Client-Side Rendering vs. Server-Side Rendering](#client-side-rendering-vs-server-side-rendering)
|
79
73
|
- [Building the Bundles](#building-the-bundles)
|
80
|
-
- [Rails Context
|
74
|
+
- [Rails Context](#rails-context)
|
81
75
|
- [Globally Exposing Your React Components](#globally-exposing-your-react-components)
|
82
76
|
- [ReactOnRails View Helpers API](#reactonrails-view-helpers-api)
|
83
77
|
- [ReactOnRails JavaScript API](#reactonrails-javascript-api)
|
@@ -215,9 +209,9 @@ When you use a "generator function" to create react components or you used share
|
|
215
209
|
1. Props that you pass in the view helper of either `react_component` or `redux_store`
|
216
210
|
2. Rails contextual information, such as the current pathname. You can customize this in your config file.
|
217
211
|
|
218
|
-
This information should be the same regardless of either client or server side rendering.
|
212
|
+
This information (`props` and `railsContext`) should be the same regardless of either client or server side rendering.
|
219
213
|
|
220
|
-
While you could manually pass
|
214
|
+
While you could manually pass the `railsContext` information in as "props", the `rails_context` is a convenience because it's passed consistently to all invocations of generator functions.
|
221
215
|
|
222
216
|
So if you register your generator function `MyAppComponent`, it will get called like:
|
223
217
|
|
@@ -230,6 +224,8 @@ and for a store:
|
|
230
224
|
reduxStore = MyReduxStore(props, railsContext);
|
231
225
|
```
|
232
226
|
|
227
|
+
Note, you never make these calls. This is what React on Rails does when either server or client rendering.
|
228
|
+
|
233
229
|
The `railsContext` has: (see implementation in file react_on_rails_helper.rb for method rails_context for the definitive list).
|
234
230
|
|
235
231
|
```ruby
|
@@ -251,23 +247,23 @@ The `railsContext` has: (see implementation in file react_on_rails_helper.rb for
|
|
251
247
|
|
252
248
|
#### Use Cases
|
253
249
|
##### Needing the current url path for server rendering
|
254
|
-
Suppose you want to display a nav bar with the current navigation link highlighted by the URL. When you server render the code, you will need to know the current URL/path if that is what you want your logic to be based on.
|
250
|
+
Suppose you want to display a nav bar with the current navigation link highlighted by the URL. When you server render the code, you will need to know the current URL/path if that is what you want your logic to be based on. The new `railsContext` has this information so the application of an "active" class can be done server side.
|
255
251
|
|
256
252
|
##### Needing the I18n.locale
|
257
|
-
Suppose you want to server render your react components with
|
258
|
-
|
253
|
+
Suppose you want to server render your react components with localization applied given the current Rails locale. The `railsContext` contains the I18n.locale.
|
259
254
|
|
260
255
|
#### Customization of the rails_context
|
261
|
-
You can customize the values passed in the
|
262
|
-
|
256
|
+
You can customize the values passed in the `railsContext` in your `config/initializers/react_on_rails.rb`. Here's how.
|
263
257
|
|
264
|
-
Set the
|
258
|
+
Set the config value for the `rendering_extension`:
|
265
259
|
|
266
260
|
```ruby
|
267
261
|
config.rendering_extension = RenderingExtension
|
268
262
|
```
|
269
263
|
|
270
|
-
Implement it like this above in the same file. Create a class method on the module called `custom_context` that takes the `view_context` for a param.
|
264
|
+
Implement it like this above in the same file. Create a class method on the module called `custom_context` that takes the `view_context` for a param.
|
265
|
+
|
266
|
+
See [spec/dummy/config/initializers/react_on_rails.rb](spec/dummy/config/initializers/react_on_rails.rb) for a detailed example.
|
271
267
|
|
272
268
|
```ruby
|
273
269
|
module RenderingExtension
|
@@ -283,9 +279,7 @@ module RenderingExtension
|
|
283
279
|
end
|
284
280
|
```
|
285
281
|
|
286
|
-
In this case, a prop and value for `somethingUseful` will go into the railsContext passed to all react_component and redux_store calls.
|
287
|
-
|
288
|
-
Since you can't access the rails session from JavaScript (or other values available in the view rendering context), this might useful.
|
282
|
+
In this case, a prop and value for `somethingUseful` will go into the railsContext passed to all react_component and redux_store calls. You may set any values available in the view rendering context.
|
289
283
|
|
290
284
|
### Globally Exposing Your React Components
|
291
285
|
Place your JavaScript code inside of the provided `client/app` folder. Use modules just as you would when using webpack alone. The difference here is that instead of mounting React components directly to an element using `React.render`, you **expose your components globally and then mount them with helpers inside of your Rails views**.
|
@@ -416,7 +410,7 @@ The `env_javascript_include_tag` and `env_stylesheet_link_tag` support the usage
|
|
416
410
|
|
417
411
|
The key options are `static` and `hot` which specify what you want for static vs. hot. Both of these params are optional, and support either a single value, or an array.
|
418
412
|
|
419
|
-
static vs. hot is picked based on whether ENV["REACT_ON_RAILS_ENV"] == "HOT"
|
413
|
+
static vs. hot is picked based on whether `ENV["REACT_ON_RAILS_ENV"] == "HOT"`
|
420
414
|
|
421
415
|
```erb
|
422
416
|
<%= env_stylesheet_link_tag(static: 'application_static',
|
@@ -666,8 +660,8 @@ Note: If you have components from react-rails you want to use, then you will nee
|
|
666
660
|
+ [Hot Reloading of Assets For Rails Development](docs/additional-reading/hot-reloading-rails-development.md)
|
667
661
|
+ [Node Dependencies and NPM](docs/additional-reading/node-dependencies-and-npm.md)
|
668
662
|
+ [React Router](docs/additional-reading/react-router.md)
|
669
|
-
+ [RSpec Configuration](docs/additional-reading/
|
670
|
-
+ [Server Rendering Tips](docs/additional-reading/
|
663
|
+
+ [RSpec Configuration](docs/additional-reading/rspec-configuration.md)
|
664
|
+
+ [Server Rendering Tips](docs/additional-reading/server-rendering-tips.md)
|
671
665
|
+ [Rails View Rendering from Inline JavaScript](docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
|
672
666
|
+ [Tips](docs/additional-reading/tips.md)
|
673
667
|
+ [Tutorial for v2.0](docs/tutorial-v2.md), deployed [here](https://shakacode-react-on-rails.herokuapp.com/).
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Gordon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -311,6 +311,7 @@ files:
|
|
311
311
|
- CHANGELOG.md
|
312
312
|
- Dockerfile_tests
|
313
313
|
- Gemfile
|
314
|
+
- KUDOS.md
|
314
315
|
- NEWS.md
|
315
316
|
- PROJECTS.md
|
316
317
|
- README.md
|
@@ -456,9 +457,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
456
457
|
version: '0'
|
457
458
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
458
459
|
requirements:
|
459
|
-
- - "
|
460
|
+
- - ">="
|
460
461
|
- !ruby/object:Gem::Version
|
461
|
-
version:
|
462
|
+
version: '0'
|
462
463
|
requirements: []
|
463
464
|
rubyforge_project:
|
464
465
|
rubygems_version: 2.6.1
|