@ -38,6 +38,8 @@ class Option extends React.PureComponent {
onSuggestionSelected : PropTypes . func . isRequired ,
intl : PropTypes . object . isRequired ,
maxChars : PropTypes . number . isRequired ,
onRemovePoll : PropTypes . func . isRequired ,
numOptions : PropTypes . number . isRequired ,
} ;
handleOptionTitleChange = e => {
@ -45,10 +47,12 @@ class Option extends React.PureComponent {
} ;
handleOptionRemove = ( ) => {
this . props . onRemove ( this . props . index ) ;
if ( this . props . numOptions > 2 )
this . props . onRemove ( this . props . index ) ;
else
this . props . onRemovePoll ( ) ;
} ;
handleToggleMultiple = e => {
this . props . onToggleMultiple ( ) ;
e . preventDefault ( ) ;
@ -95,7 +99,7 @@ class Option extends React.PureComponent {
< / l a b e l >
< div className = 'poll__cancel' >
< IconButton disabled= { index <= 1 } title= { intl . formatMessage ( messages . remove _option ) } icon = 'times' onClick = { this . handleOptionRemove } / >
< IconButton title= { intl . formatMessage ( messages . remove _option ) } icon = 'times' onClick = { this . handleOptionRemove } / >
< / d i v >
< / l i >
) ;
@ -156,6 +160,7 @@ class PollForm extends ImmutablePureComponent {
isPollMultiple = { isMultiple }
onToggleMultiple = { this . handleToggleMultiple }
maxChars = { maxOptionChars }
numOptions = { options . size }
{ ... other }
/ >
) ) }