react-rails 1.3.3 → 1.4.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b0add932e37ac43fea18b43d735f629beddd7fa
4
- data.tar.gz: 23b384f84760fd7c3e6acaa544f8bba42225c681
3
+ metadata.gz: 59c0e2d224ae087eecda65188c20d2bfcff98e7b
4
+ data.tar.gz: e83257d235e950105dfc5a6367abcbcb56075508
5
5
  SHA512:
6
- metadata.gz: 5f4838f09a9be35626d8e9dc0b3b0dda3154946a4734197f364f17c6ca2ab614030197360565cf735f6e7e150eeed37fa257237fcd4a98413d5529395c1695dc
7
- data.tar.gz: a5df10dca7daa874f0afef8426e7f947d633b4ae248d684e2663ae33034142c6462b24600e7b84c9657625232c0b051d0f130d65308f35be94bb6a0e515a829d
6
+ metadata.gz: d9c0e1194927b94f6b618b2ffc33f41feb8d609f4468cba49f9d143a86b5b2ac7383a9109ea3ebc37e85e3a9ccd562b80bef87a024fee7a45ce2fcb32c4ba3f8
7
+ data.tar.gz: ffb97409f51d621879ebf3fad89bdcf3f0e972a63403b497ee12017e5665ad91a7729b2daa63d85ba94dbc82ae28e6bdae6bff68b9d2242b799a3ff76b150bb6
data/README.md CHANGED
@@ -19,12 +19,14 @@ in your Ruby on Rails (3.2+) application. `react-rails` can:
19
19
  - [Generate components](#component-generator) with a Rails generator
20
20
  - [Be extended](#extending-react-rails) with custom renderers, transformers and view helpers
21
21
 
22
+ Just getting started with React? Make sure to check out the [Getting Started] (https://facebook.github.io/react/docs/getting-started.html) guide.
23
+
22
24
  ## Installation
23
25
 
24
26
  Add `react-rails` to your gemfile:
25
27
 
26
28
  ```ruby
27
- gem 'react-rails', '~> 1.3.0'
29
+ gem 'react-rails', '~> 1.4.0'
28
30
  ```
29
31
 
30
32
  Next, run the installation script:
@@ -194,7 +196,7 @@ MyApp::Application.configure do
194
196
  config.react.server_renderer_timeout ||= 20 # seconds
195
197
  config.react.server_renderer = React::ServerRendering::SprocketsRenderer
196
198
  config.react.server_renderer_options = {
197
- files: ["react.js", "components.js"], # files to load for prerendering
199
+ files: ["react-server.js", "components.js"], # files to load for prerendering
198
200
  replay_console: true, # if true, console.* will be replayed client-side
199
201
  }
200
202
  end
@@ -212,13 +214,14 @@ Components can also be prerendered directly from a controller action with the cu
212
214
  class TodoController < ApplicationController
213
215
  def index
214
216
  @todos = Todo.all
215
- render component: 'TodoList', props: { todos: @todos }, tag: 'span'
217
+ render component: 'TodoList', props: { todos: @todos }, tag: 'span', class: 'todo'
216
218
  end
217
219
  end
218
220
  ```
219
221
 
220
222
  This custom renderer behaves the same as a normal view renderer and accepts the usual arguments - `content_type`, `layout`, `location` and `status`.
221
- By default, your current layout will be used and the component, rather than a view, will be rendered in place of `yield`.
223
+ By default, your current layout will be used and the component, rather than a view, will be rendered in place of `yield`. Custom data-* attributes
224
+ can be passed like `data: {remote: true}`.
222
225
 
223
226
  ### Component generator
224
227
 
@@ -268,6 +271,14 @@ For example:
268
271
  rails generate react:component Label label:string --es6
269
272
  ```
270
273
 
274
+ **--coffee** : Generate the component using CoffeeScript syntax
275
+
276
+ For example:
277
+
278
+ ```shell
279
+ rails generate react:component Label label:string --coffee
280
+ ```
281
+
271
282
  #### Arguments
272
283
 
273
284
  The generator can use the following arguments to create basic propTypes:
@@ -323,6 +334,14 @@ Component = React.createClass
323
334
  `<ExampleComponent videos={this.props.videos} />`
324
335
  ```
325
336
 
337
+ Alternatively, the newer ES6 style class based syntax can be used like this:
338
+
339
+ ```coffee
340
+ class Component extends React.Component
341
+ render: ->
342
+ `<ExampleComponent videos={this.props.videos} />`
343
+ ```
344
+
326
345
  ## Extending `react-rails`
327
346
 
328
347
  You can extend some of the core functionality of `react-rails` by injecting new implementations during configuration.