|
|
|
@ -11,6 +11,7 @@ export default class ConfirmationModal extends React.PureComponent { |
|
|
|
|
confirm: PropTypes.string.isRequired, |
|
|
|
|
onClose: PropTypes.func.isRequired, |
|
|
|
|
onConfirm: PropTypes.func.isRequired, |
|
|
|
|
onDoNotAsk: PropTypes.func, |
|
|
|
|
intl: PropTypes.object.isRequired, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -21,6 +22,9 @@ export default class ConfirmationModal extends React.PureComponent { |
|
|
|
|
handleClick = () => { |
|
|
|
|
this.props.onClose(); |
|
|
|
|
this.props.onConfirm(); |
|
|
|
|
if (this.props.onDoNotAsk && this.doNotAskCheckbox.checked) { |
|
|
|
|
this.props.onDoNotAsk(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleCancel = () => { |
|
|
|
@ -31,8 +35,12 @@ export default class ConfirmationModal extends React.PureComponent { |
|
|
|
|
this.button = c; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setDoNotAskRef = (c) => { |
|
|
|
|
this.doNotAskCheckbox = c; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
|
const { message, confirm } = this.props; |
|
|
|
|
const { message, confirm, onDoNotAsk } = this.props; |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div className='modal-root__modal confirmation-modal'> |
|
|
|
@ -40,11 +48,21 @@ export default class ConfirmationModal extends React.PureComponent { |
|
|
|
|
{message} |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div className='confirmation-modal__action-bar'> |
|
|
|
|
<Button onClick={this.handleCancel} className='confirmation-modal__cancel-button'> |
|
|
|
|
<FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' /> |
|
|
|
|
</Button> |
|
|
|
|
<Button text={confirm} onClick={this.handleClick} ref={this.setRef} /> |
|
|
|
|
<div> |
|
|
|
|
{ onDoNotAsk && ( |
|
|
|
|
<div className='confirmation-modal__do_not_ask_again'> |
|
|
|
|
<input type='checkbox' id='confirmation-modal__do_not_ask_again-checkbox' ref={this.setDoNotAskRef} /> |
|
|
|
|
<label for='confirmation-modal__do_not_ask_again-checkbox'> |
|
|
|
|
<FormattedMessage id='confirmation_modal.do_not_ask_again' defaultMessage='Do not ask for confirmation again' /> |
|
|
|
|
</label> |
|
|
|
|
</div> |
|
|
|
|
)} |
|
|
|
|
<div className='confirmation-modal__action-bar'> |
|
|
|
|
<Button onClick={this.handleCancel} className='confirmation-modal__cancel-button'> |
|
|
|
|
<FormattedMessage id='confirmation_modal.cancel' defaultMessage='Cancel' /> |
|
|
|
|
</Button> |
|
|
|
|
<Button text={confirm} onClick={this.handleClick} ref={this.setRef} /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|