password fix, overlay dialog fix

This commit is contained in:
GotPPay
2018-05-31 19:08:48 +02:00
parent 182cde9fbb
commit bf3f372ab4
4 changed files with 70 additions and 28 deletions

View File

@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import FlatButton from 'material-ui/FlatButton';
import MaterialDialog from 'material-ui/Dialog';
import Dialog from './draggable-dialog';
import './draggable-dialog/css/index.css';
@@ -45,30 +46,49 @@ export class ValidationErrorsInfoDialog extends React.Component {
/>,
];
const dialogContent = (
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;
}
})
)
const draggableDialog =
(<Dialog
title={this.props.title ? this.props.title : 'Error'}
isDraggable={true}
buttons={actions}
hasCloseIcon={false}
modal={this.props.modal ? this.props.modal : false}
height={defaultDialogHeight + this.props.errorMessages.length * dialogHeightPerLine}>
{dialogContent}
</Dialog>
)
const normalDialog =
(<MaterialDialog
open={this.state.open}
title={this.props.title ? this.props.title : 'Error'}
onBackdropClick={()=>{console.log("Backdrop")}}
actions={actions}>
{dialogContent}
</MaterialDialog>
)
return (
<div className="container">
{
this.state.open &&
<Dialog
title={this.props.title ? this.props.title : 'Error'}
isDraggable={this.props.draggable ? this.props.draggable : false}
buttons={actions}
hasCloseIcon={false}
modal={this.props.modal ? this.props.modal : false}
height={defaultDialogHeight + this.props.errorMessages.length * dialogHeightPerLine}
>
{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;
}
})}
</Dialog>
}
{this.state.open && this.props.draggable && draggableDialog }
{this.state.open && !this.props.draggable && normalDialog}
</div>
);
}