-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic Setup of the routing and the Index/Show Components. Basically, for now we are trying to render the exact same thing but on the client side. The next step will require the loading of the data.
- Loading branch information
Showing
8 changed files
with
56 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
alert "I get loaded" | ||
React = require('react') | ||
Router = require('react-router') | ||
routes = require('routes') | ||
|
||
Router.run routes, Router.HistoryLocation, (Handler, state) -> | ||
React.render(<Handler />, document.getElementById("reactContent")) |
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,10 @@ | ||
React = require('react') | ||
|
||
Index = React.createClass | ||
displayName: "PostsIndex" | ||
render: -> | ||
<div> | ||
<h3>Posts Index</h3> | ||
</div> | ||
|
||
module.exports = Index |
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,10 @@ | ||
React = require('react') | ||
|
||
Show = React.createClass | ||
displayName: "PostShow" | ||
render: -> | ||
<div> | ||
<h3>Posts Show</h3> | ||
</div> | ||
|
||
module.exports = Show |
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,22 @@ | ||
React = require('react') | ||
Router = require('react-router') | ||
|
||
DefaultRoute = Router.DefaultRoute | ||
Route = Router.Route | ||
|
||
PostsIndex = require "components/posts/index" | ||
PostShow = require "components/posts/show" | ||
|
||
routes = ( | ||
<Route name="app" path="/"> | ||
<Route name="posts"> | ||
<Route name="post" path=":postId"> | ||
<DefaultRoute handler={PostShow} /> | ||
</Route> | ||
<DefaultRoute handler={PostsIndex} /> | ||
</Route> | ||
<DefaultRoute handler={PostsIndex} /> | ||
</Route> | ||
) | ||
|
||
module.exports = routes |
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
"json-loader": "*" | ||
}, | ||
"dependencies": { | ||
|
||
"react": "*", | ||
"react-router": "*" | ||
} | ||
} |
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 |
---|---|---|
|
@@ -52,7 +52,7 @@ article { | |
} | ||
} | ||
|
||
#content { | ||
#content, #reactContent { | ||
margin: 12px auto; | ||
max-width: 600px; | ||
|
||
|
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 |
---|---|---|
|
@@ -21,6 +21,9 @@ | |
<div id="content"> | ||
<%= yield %> | ||
</div> | ||
<div id="reactContent"> | ||
|
||
</div> | ||
|
||
</div> | ||
|
||
|