File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ module.exports = React.createClass({
23
23
/>
24
24
</ span >
25
25
< input type = "text"
26
+ disabled = { this . state . done }
26
27
className = "form-control"
27
28
value = { this . state . text }
28
29
onChange = { this . handleTextChange }
@@ -42,12 +43,32 @@ module.exports = React.createClass({
42
43
if ( ! this . state . textChanged ) {
43
44
return null
44
45
} else {
45
- return < span >
46
- < button className = "btn btn-default" > Save</ button >
47
- < button className = "btn btn-default" > Undo</ button >
48
- </ span >
46
+ return [
47
+ < button
48
+ className = "btn btn-default"
49
+ onClick = { this . handleSaveClick }
50
+ >
51
+ Save
52
+ </ button > ,
53
+ < button
54
+ onClick = { this . handleUndoClick }
55
+ className = "btn btn-default"
56
+ >
57
+ Undo
58
+ </ button >
59
+ ]
49
60
}
50
61
} ,
62
+ handleSaveClick : function ( ) {
63
+ this . fb . update ( { text : this . state . text } ) ;
64
+ this . setState ( { textChanged : false } ) ;
65
+ } ,
66
+ handleUndoClick : function ( ) {
67
+ this . setState ( {
68
+ text : this . props . item . text ,
69
+ textChanged : false
70
+ } ) ;
71
+ } ,
51
72
handleTextChange : function ( event ) {
52
73
this . setState ( {
53
74
text : event . target . value ,
You can’t perform that action at this time.
0 commit comments