2018-05-22 12:41:39 +02:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
import FlatButton from 'material-ui/FlatButton';
|
2018-05-23 18:05:41 +02:00
|
|
|
import Dialog from './draggable-dialog';
|
2018-05-23 04:48:57 +02:00
|
|
|
|
2018-05-23 18:05:41 +02:00
|
|
|
import './draggable-dialog/css/index.css';
|
2018-05-22 12:41:39 +02:00
|
|
|
|
2018-05-23 20:08:52 +02:00
|
|
|
const defaultDialogHeight = 100; //px
|
|
|
|
|
const dialogHeightPerLine = 25; //px
|
|
|
|
|
|
2018-05-22 12:41:39 +02:00
|
|
|
export class ValidationErrorsInfoDialog extends React.Component {
|
2018-05-21 17:21:23 +02:00
|
|
|
|
|
|
|
|
state = {
|
2018-05-22 12:41:39 +02:00
|
|
|
open: this.props.open,
|
|
|
|
|
}
|
2018-05-21 17:21:23 +02:00
|
|
|
|
|
|
|
|
componentWillReceiveProps(newProps){
|
|
|
|
|
this.setState({open: newProps.open});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleOpen = () => {
|
|
|
|
|
this.setState({ open: true });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleClose = () => {
|
|
|
|
|
this.setState({ open: false });
|
|
|
|
|
this.props.onDismiss();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
2018-05-23 04:48:57 +02:00
|
|
|
|
2018-05-28 14:06:15 +02:00
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Dialog
|
|
|
|
|
title="Errors"
|
|
|
|
|
actions={actions}
|
|
|
|
|
modal={this.props.modal ? this.props.modal : false}
|
|
|
|
|
open={this.state.open}
|
|
|
|
|
onRequestClose={this.handleClose}
|
|
|
|
|
overlayStyle={{ backgroundColor: 'transparent' }}
|
|
|
|
|
>
|
|
|
|
|
{this.props.errorMessages.map(errorMessage => {
|
|
|
|
|
const oneValidationMessage = (<span><a>{errorMessage.message}</a><br /></span>);
|
|
|
|
|
const oneValidationMessageWithTab = (<span><li style={{ marginLeft: 2 + "em" }}>{errorMessage.message}</li></span>);
|
|
|
|
|
|
|
|
|
|
if (errorMessage.field_name === "password-tab") {
|
|
|
|
|
return oneValidationMessageWithTab;
|
|
|
|
|
} else {
|
|
|
|
|
return oneValidationMessage;
|
2018-05-23 04:48:57 +02:00
|
|
|
}
|
2018-05-28 14:06:15 +02:00
|
|
|
})}
|
|
|
|
|
</Dialog>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2018-05-22 12:41:39 +02:00
|
|
|
}
|
2018-05-28 16:12:02 +02:00
|
|
|
}
|
2018-05-22 12:41:39 +02:00
|
|
|
|
2018-05-28 16:12:02 +02:00
|
|
|
module.exports = ValidationErrorsInfoDialog;
|