mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
remove dependency on Telescope flash messages from NovaForms
This commit is contained in:
parent
cf0320b72b
commit
2b64fd56da
3 changed files with 23 additions and 2 deletions
|
@ -26,6 +26,8 @@ This package can generate new document and edit document forms from a [SimpleSch
|
|||
react react-intl formsy-react react-bootstrap formsy-react-components
|
||||
```
|
||||
|
||||
You also need to load Bootstrap's CSS separately.
|
||||
|
||||
### Usage
|
||||
|
||||
Example schema:
|
||||
|
|
20
packages/nova-forms/lib/Flash.jsx
Normal file
20
packages/nova-forms/lib/Flash.jsx
Normal file
|
@ -0,0 +1,20 @@
|
|||
import React, { PropTypes, Component } from 'react';
|
||||
import { Alert } from 'react-bootstrap';
|
||||
|
||||
const Flash = () => {
|
||||
|
||||
let type = this.props.message.type;
|
||||
type = type === "error" ? "danger" : type; // if type is "error", use "danger" instead
|
||||
|
||||
return (
|
||||
<Alert className="flash-message" bsStyle={type}>
|
||||
{this.props.message.content}
|
||||
</Alert>
|
||||
)
|
||||
}
|
||||
|
||||
Flash.propTypes = {
|
||||
message: React.PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
export default Flash;
|
|
@ -2,7 +2,7 @@ import React, { PropTypes, Component } from 'react';
|
|||
import { FormattedMessage, intlShape } from 'react-intl';
|
||||
import Formsy from 'formsy-react';
|
||||
import { Button } from 'react-bootstrap';
|
||||
|
||||
import Flash from "./Flash.jsx";
|
||||
import FormGroup from "./FormGroup.jsx";
|
||||
import { flatten, deepValue, getEditableFields, getInsertableFields } from './utils.js';
|
||||
|
||||
|
@ -212,7 +212,6 @@ class NovaForm extends Component{
|
|||
|
||||
// render errors
|
||||
renderErrors() {
|
||||
Flash = Telescope.components.Flash;
|
||||
return <div className="form-errors">{this.state.errors.map(message => <Flash key={message} message={message}/>)}</div>
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue