-
-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
180 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
...t_on_rails/templates/base/base/client/app/bundles/HelloWorld/components/HelloWorld.jsx.tt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
..._rails/templates/no_redux/base/client/app/bundles/HelloWorld/components/HelloWorldApp.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { PropTypes } from 'react'; | ||
|
||
export default class HelloWorldApp extends React.Component { | ||
static propTypes = { | ||
name: PropTypes.string.isRequired, // this is passed from the Rails view | ||
}; | ||
|
||
/** | ||
* @param props - Comes from your rails view. | ||
* @param _railsContext - Comes from React on Rails | ||
*/ | ||
constructor(props, _railsContext) { | ||
super(props); | ||
|
||
// How to set initial state in ES6 class syntax | ||
// https://facebook.github.io/react/docs/reusable-components.html#es6-classes | ||
this.state = { name: this.props.name }; | ||
} | ||
|
||
updateName = (name) => { | ||
this.setState({ name }); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<h3> | ||
Hello, {this.state.name}! | ||
</h3> | ||
<hr /> | ||
<form > | ||
<label htmlFor="name"> | ||
Say hello to: | ||
</label> | ||
<input | ||
id="name" | ||
type="text" | ||
value={this.state.name} | ||
onChange={(e) => this.updateName(e.target.value)} | ||
/> | ||
</form> | ||
</div> | ||
); | ||
} | ||
} |
25 changes: 0 additions & 25 deletions
25
.../templates/no_redux/base/client/app/bundles/HelloWorld/containers/HelloWorldContainer.jsx
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
..._rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/HelloWorldApp.jsx.tt
This file was deleted.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...t_on_rails/templates/no_redux/base/client/app/bundles/HelloWorld/startup/registration.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import ReactOnRails from 'react-on-rails'; | ||
|
||
import HelloWorldApp from '../components/HelloWorldApp'; | ||
|
||
// This is how react_on_rails can see the HelloWorld in the browser. | ||
ReactOnRails.register({ | ||
HelloWorldApp, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...act_on_rails/templates/redux/base/client/app/bundles/HelloWorld/components/HelloWorld.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { PropTypes } from 'react'; | ||
|
||
export default class HelloWorld extends React.Component { | ||
static propTypes = { | ||
name: PropTypes.string.isRequired, // this is passed from the Rails view | ||
}; | ||
|
||
/** | ||
* @param props - Comes from your rails view. | ||
* @param _railsContext - Comes from React on Rails | ||
*/ | ||
constructor(props, _railsContext) { | ||
super(props); | ||
|
||
// How to set initial state in ES6 class syntax | ||
// https://facebook.github.io/react/docs/reusable-components.html#es6-classes | ||
this.state = { name: this.props.name }; | ||
} | ||
|
||
updateName = (name) => { | ||
this.setState({ name }); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<h3> | ||
Hello, {this.state.name}! | ||
</h3> | ||
<hr /> | ||
<form > | ||
<label htmlFor="name"> | ||
Say hello to: | ||
</label> | ||
<input | ||
id="name" | ||
type="text" | ||
value={this.state.name} | ||
onChange={(e) => this.updateName(e.target.value)} | ||
/> | ||
</form> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...t_on_rails/templates/redux/base/client/app/bundles/HelloWorld/startup/registration.jsx.tt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import ReactOnRails from 'react-on-rails'; | ||
|
||
import HelloWorldApp from './HelloWorldApp'; | ||
|
||
// This is how react_on_rails can see the HelloWorldApp in the browser. | ||
ReactOnRails.register({ HelloWorldApp }); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.