Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 50e8cae

Browse files
author
dodortus
committed
* add comments
1 parent 925f038 commit 50e8cae

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

comments.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,30 @@
3333
"id": 1464862194961,
3434
"author": "11111",
3535
"text": "22222222222"
36+
},
37+
{
38+
"id": 1464862368016,
39+
"author": "hy",
40+
"text": "121233"
41+
},
42+
{
43+
"id": 1464862371433,
44+
"author": "222",
45+
"text": "2222222"
46+
},
47+
{
48+
"id": 1464862416312,
49+
"author": "jhgjgjgjg",
50+
"text": "khkjhkhkhk"
51+
},
52+
{
53+
"id": 1464862508034,
54+
"author": "2222",
55+
"text": "1111"
56+
},
57+
{
58+
"id": 1464862518122,
59+
"author": "121221",
60+
"text": "2222"
3661
}
3762
]

public/scripts/example.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1111
*/
1212

13+
/*
14+
- CommentBox
15+
- CommentList
16+
- Comment
17+
- CommentForm
18+
*/
19+
20+
/**
21+
* Comment
22+
*/
1323
var Comment = React.createClass({
1424
rawMarkup: function() {
1525
var rawMarkup = marked(this.props.children.toString(), {sanitize: true});
@@ -28,6 +38,9 @@ var Comment = React.createClass({
2838
}
2939
});
3040

41+
/**
42+
* CommentBox
43+
*/
3144
var CommentBox = React.createClass({
3245
loadCommentsFromServer: function() {
3346
$.ajax({
@@ -82,6 +95,9 @@ var CommentBox = React.createClass({
8295
}
8396
});
8497

98+
/**
99+
* CommentList
100+
*/
85101
var CommentList = React.createClass({
86102
render: function() {
87103
var commentNodes = this.props.data.map(function(comment) {
@@ -99,6 +115,9 @@ var CommentList = React.createClass({
99115
}
100116
});
101117

118+
/**
119+
* CommentForm
120+
*/
102121
var CommentForm = React.createClass({
103122
getInitialState: function() {
104123
return {author: '', text: ''};
@@ -140,6 +159,9 @@ var CommentForm = React.createClass({
140159
}
141160
});
142161

162+
/**
163+
* render view
164+
*/
143165
ReactDOM.render(
144166
<CommentBox url="/api/comments" pollInterval={2000} />,
145167
document.getElementById('content')

0 commit comments

Comments
 (0)