@@ -29,18 +29,18 @@ export default class CommentForm extends BaseComponent {
29
29
} ;
30
30
31
31
_ . bindAll ( this , [
32
- '_handleSelect ' ,
33
- '_handleChange ' ,
34
- '_handleSubmit ' ,
35
- '_resetAndFocus ' ,
32
+ 'handleSelect ' ,
33
+ 'handleChange ' ,
34
+ 'handleSubmit ' ,
35
+ 'resetAndFocus ' ,
36
36
] ) ;
37
37
}
38
38
39
- _handleSelect ( selectedKey ) {
39
+ handleSelect ( selectedKey ) {
40
40
this . setState ( { formMode : selectedKey } ) ;
41
41
}
42
42
43
- _handleChange ( ) {
43
+ handleChange ( ) {
44
44
let comment ;
45
45
46
46
switch ( this . state . formMode ) {
@@ -71,15 +71,15 @@ export default class CommentForm extends BaseComponent {
71
71
this . setState ( { comment } ) ;
72
72
}
73
73
74
- _handleSubmit ( e ) {
74
+ handleSubmit ( e ) {
75
75
e . preventDefault ( ) ;
76
76
const { actions } = this . props ;
77
77
actions
78
78
. submitComment ( this . state . comment )
79
- . then ( this . _resetAndFocus ) ;
79
+ . then ( this . resetAndFocus ) ;
80
80
}
81
81
82
- _resetAndFocus ( ) {
82
+ resetAndFocus ( ) {
83
83
// Don't reset a form that didn't submit, this results in data loss
84
84
if ( this . props . error ) return ;
85
85
@@ -104,11 +104,11 @@ export default class CommentForm extends BaseComponent {
104
104
ref . focus ( ) ;
105
105
}
106
106
107
- _formHorizontal ( ) {
107
+ formHorizontal ( ) {
108
108
return (
109
109
< div >
110
110
< hr />
111
- < form className = "commentForm form-horizontal" onSubmit = { this . _handleSubmit } >
111
+ < form className = "commentForm form-horizontal" onSubmit = { this . handleSubmit } >
112
112
< Input
113
113
type = "text"
114
114
label = "Name"
@@ -117,7 +117,7 @@ export default class CommentForm extends BaseComponent {
117
117
wrapperClassName = "col-sm-10"
118
118
ref = { node => { this . horizontalAuthorNode = node ; } }
119
119
value = { this . state . comment . author }
120
- onChange = { this . _handleChange }
120
+ onChange = { this . handleChange }
121
121
disabled = { this . props . isSaving }
122
122
/>
123
123
< Input
@@ -128,7 +128,7 @@ export default class CommentForm extends BaseComponent {
128
128
wrapperClassName = "col-sm-10"
129
129
ref = { node => { this . horizontalTextNode = node ; } }
130
130
value = { this . state . comment . text }
131
- onChange = { this . _handleChange }
131
+ onChange = { this . handleChange }
132
132
disabled = { this . props . isSaving }
133
133
/>
134
134
< div className = "form-group" >
@@ -146,18 +146,18 @@ export default class CommentForm extends BaseComponent {
146
146
) ;
147
147
}
148
148
149
- _formStacked ( ) {
149
+ formStacked ( ) {
150
150
return (
151
151
< div >
152
152
< hr />
153
- < form className = "commentForm form" onSubmit = { this . _handleSubmit } >
153
+ < form className = "commentForm form" onSubmit = { this . handleSubmit } >
154
154
< Input
155
155
type = "text"
156
156
label = "Name"
157
157
placeholder = "Your Name"
158
158
ref = { node => { this . stackedAuthorNode = node ; } }
159
159
value = { this . state . comment . author }
160
- onChange = { this . _handleChange }
160
+ onChange = { this . handleChange }
161
161
disabled = { this . props . isSaving }
162
162
/>
163
163
< Input
@@ -166,7 +166,7 @@ export default class CommentForm extends BaseComponent {
166
166
placeholder = { textPlaceholder }
167
167
ref = { node => { this . stackedTextNode = node ; } }
168
168
value = { this . state . comment . text }
169
- onChange = { this . _handleChange }
169
+ onChange = { this . handleChange }
170
170
disabled = { this . props . isSaving }
171
171
/>
172
172
< input
@@ -180,11 +180,11 @@ export default class CommentForm extends BaseComponent {
180
180
) ;
181
181
}
182
182
183
- _formInline ( ) {
183
+ formInline ( ) {
184
184
return (
185
185
< div >
186
186
< hr />
187
- < form className = "commentForm form" onSubmit = { this . _handleSubmit } >
187
+ < form className = "commentForm form" onSubmit = { this . handleSubmit } >
188
188
< Input label = "Inline Form" wrapperClassName = "wrapper" >
189
189
< Row >
190
190
< Col xs = { 3 } >
@@ -194,7 +194,7 @@ export default class CommentForm extends BaseComponent {
194
194
placeholder = "Your Name"
195
195
ref = { node => { this . inlineAuthorNode = node ; } }
196
196
value = { this . state . comment . author }
197
- onChange = { this . _handleChange }
197
+ onChange = { this . handleChange }
198
198
disabled = { this . props . isSaving }
199
199
/>
200
200
</ Col >
@@ -205,7 +205,7 @@ export default class CommentForm extends BaseComponent {
205
205
placeholder = { textPlaceholder }
206
206
ref = { node => { this . inlineTextNode = node ; } }
207
207
value = { this . state . comment . text }
208
- onChange = { this . _handleChange }
208
+ onChange = { this . handleChange }
209
209
disabled = { this . props . isSaving }
210
210
/>
211
211
</ Col >
@@ -224,7 +224,7 @@ export default class CommentForm extends BaseComponent {
224
224
) ;
225
225
}
226
226
227
- _errorWarning ( ) {
227
+ errorWarning ( ) {
228
228
// If there is no error, there is nothing to add to the DOM
229
229
if ( ! this . props . error ) return null ;
230
230
return (
@@ -239,13 +239,13 @@ export default class CommentForm extends BaseComponent {
239
239
let inputForm ;
240
240
switch ( this . state . formMode ) {
241
241
case 0 :
242
- inputForm = this . _formHorizontal ( ) ;
242
+ inputForm = this . formHorizontal ( ) ;
243
243
break ;
244
244
case 1 :
245
- inputForm = this . _formStacked ( ) ;
245
+ inputForm = this . formStacked ( ) ;
246
246
break ;
247
247
case 2 :
248
- inputForm = this . _formInline ( ) ;
248
+ inputForm = this . formInline ( ) ;
249
249
break ;
250
250
default :
251
251
throw new Error ( `Unknown form mode: ${ this . state . formMode } .` ) ;
@@ -260,10 +260,10 @@ export default class CommentForm extends BaseComponent {
260
260
transitionEnterTimeout = { 300 }
261
261
transitionLeaveTimeout = { 300 }
262
262
>
263
- { this . _errorWarning ( ) }
263
+ { this . errorWarning ( ) }
264
264
</ ReactCSSTransitionGroup >
265
265
266
- < Nav bsStyle = "pills" activeKey = { this . state . formMode } onSelect = { this . _handleSelect } >
266
+ < Nav bsStyle = "pills" activeKey = { this . state . formMode } onSelect = { this . handleSelect } >
267
267
< NavItem eventKey = { 0 } > Horizontal Form</ NavItem >
268
268
< NavItem eventKey = { 1 } > Stacked Form</ NavItem >
269
269
< NavItem eventKey = { 2 } > Inline Form</ NavItem >
0 commit comments