react-on-rails
Advanced tools
Comparing version 5.0.0-rc.1 to 5.0.0
@@ -16,3 +16,3 @@ # Change Log | ||
##### Breaking Changes | ||
- You must provide named attributes, including `props` for view helper `react_compnent`. | ||
- 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). | ||
@@ -19,0 +19,0 @@ ## [4.0.3] - 2016-03-17 |
{ | ||
"name": "react-on-rails", | ||
"version": "5.0.0-rc.1", | ||
"version": "5.0.0", | ||
"description": "react-on-rails JavaScript for react_on_rails Ruby gem", | ||
@@ -5,0 +5,0 @@ "main": "node_package/lib/ReactOnRails.js", |
[![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) | ||
# NEWS | ||
* 5.0.0.rc.1 has shipped! Please let me know if you're tried it and if you like the changes. | ||
* Please see the [CHANGELOG.md](./CHANGELOG.md) for details on the latest release and any breaking changes. | ||
* [New slides on React on Rails](http://www.slideshare.net/justingordon/react-on-rails-v4032). | ||
* Always see the [CHANGELOG.md](./CHANGELOG.md) for the latest project changes. | ||
* 2016-03-17: **4.0.3** Shipped! Includes using the new Heroku buildpack steps, several smaller changes detailed in the [CHANGELOG.md](./CHANGELOG.md). | ||
* 2016-03-14: **4.0.0** Highlights | ||
* Better support for hot reloading of assets from Rails with new helpers and updates to the sample testing app, [spec/dummy](spec/dummy). | ||
* Better support for Turbolinks 5. | ||
* Controller rendering of shared redux stores and ability to render store data at bottom of HTML page. | ||
* See [#311](https://github.com/shakacode/react_on_rails/pull/311/files). | ||
* Some breaking changes! See [CHANGELOG.md](./CHANGELOG.md) for details. | ||
* 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). | ||
* 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. | ||
* *See [NEWS.md](NEWS.md) for the full news history.* | ||
@@ -31,3 +25,3 @@ | ||
* [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). | ||
* [Projects](PROJECTS.md) using React on Rails. Please submit yours! | ||
* [Projects](PROJECTS.md) using and [KUDOS](./KUDOS.md) for React on Rails. Please submit yours! | ||
* On Twitter, follow [@railsonmaui](https://twitter.com/railsonmaui) and [@shakacode](https://twitter.com/shakacode) for updates on releases. | ||
@@ -81,3 +75,3 @@ | ||
- [Building the Bundles](#building-the-bundles) | ||
- [Rails Context)(#rails-context) | ||
- [Rails Context](#rails-context) | ||
- [Globally Exposing Your React Components](#globally-exposing-your-react-components) | ||
@@ -220,5 +214,5 @@ - [ReactOnRails View Helpers API](#reactonrails-view-helpers-api) | ||
This information should be the same regardless of either client or server side rendering. | ||
This information (`props` and `railsContext`) should be the same regardless of either client or server side rendering. | ||
While you could manually pass this information in as "props", the rails_context is a convenience because it's pass consistently to all invocations of generator functions. | ||
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. | ||
@@ -236,2 +230,4 @@ So if you register your generator function `MyAppComponent`, it will get called like: | ||
Note, you never make these calls. This is what React on Rails does when either server or client rendering. | ||
The `railsContext` has: (see implementation in file react_on_rails_helper.rb for method rails_context for the definitive list). | ||
@@ -258,14 +254,12 @@ | ||
##### Needing the current url path for server rendering | ||
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. This could be added to props, or ReactOnRails can add this automatically as another param to the generator function (or maybe an additional object, where we'll consider other additional bits of system info from Rails, like maybe the locale, later). | ||
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. | ||
##### Needing the I18n.locale | ||
Suppose you want to server render your react components with a the current Rails locale. We need to pass the I18n.locale to the view rendering. | ||
Suppose you want to server render your react components with localization applied given the current Rails locale. The `railsContext` contains the I18n.locale. | ||
#### Customization of the rails_context | ||
You can customize the values passed in the rails_context in your `config/initializers/react_on_rails.rb` | ||
You can customize the values passed in the `railsContext` in your `config/initializers/react_on_rails.rb`. Here's how. | ||
Set the config value for the `rendering_extension`: | ||
Set the class for the `rendering_extension`: | ||
```ruby | ||
@@ -275,4 +269,6 @@ config.rendering_extension = RenderingExtension | ||
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. | ||
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. | ||
See [spec/dummy/config/initializers/react_on_rails.rb](spec/dummy/config/initializers/react_on_rails.rb) for a detailed example. | ||
```ruby | ||
@@ -292,6 +288,4 @@ module RenderingExtension | ||
In this case, a prop and value for `somethingUseful` will go into the railsContext passed to all react_component and redux_store calls. | ||
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. | ||
Since you can't access the rails session from JavaScript (or other values available in the view rendering context), this might useful. | ||
### Globally Exposing Your React Components | ||
@@ -426,3 +420,3 @@ 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**. | ||
static vs. hot is picked based on whether ENV["REACT_ON_RAILS_ENV"] == "HOT" | ||
static vs. hot is picked based on whether `ENV["REACT_ON_RAILS_ENV"] == "HOT"` | ||
@@ -677,4 +671,4 @@ ```erb | ||
+ [React Router](docs/additional-reading/react-router.md) | ||
+ [RSpec Configuration](docs/additional-reading/rspec_configuration.md) | ||
+ [Server Rendering Tips](docs/additional-reading/server_rendering_tips.md) | ||
+ [RSpec Configuration](docs/additional-reading/rspec-configuration.md) | ||
+ [Server Rendering Tips](docs/additional-reading/server-rendering-tips.md) | ||
+ [Rails View Rendering from Inline JavaScript](docs/additional-reading/rails_view_rendering_from_inline_javascript.md) | ||
@@ -681,0 +675,0 @@ + [Tips](docs/additional-reading/tips.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
95056
713