mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
clean up modals
This commit is contained in:
parent
01b60e9759
commit
6342aca8a0
6 changed files with 14 additions and 11 deletions
|
@ -8,7 +8,7 @@ const NewPostButton = (props, context) => {
|
|||
({PostNewForm} = Telescope.components);
|
||||
|
||||
return (
|
||||
<ModalTrigger component={<Button bsStyle="primary">New Post</Button>}>
|
||||
<ModalTrigger title="New Post" component={<Button bsStyle="primary">New Post</Button>}>
|
||||
<PostNewForm/>
|
||||
</ModalTrigger>
|
||||
)
|
||||
|
|
|
@ -32,10 +32,6 @@ class PostEditForm extends Component{
|
|||
|
||||
return (
|
||||
<div className="edit-post-form">
|
||||
<div className="modal-form-title edit-post-form-header">
|
||||
<h3>Edit Post</h3>
|
||||
<a onClick={this.deletePost} className="delete-post-link"><Icon name="close"/> Delete Post</a>
|
||||
</div>
|
||||
<DocumentContainer
|
||||
collection={Posts}
|
||||
publication="posts.single"
|
||||
|
@ -51,6 +47,8 @@ class PostEditForm extends Component{
|
|||
labelFunction: (fieldName)=>Telescope.utils.getFieldLabel(fieldName, Posts)
|
||||
}}
|
||||
/>
|
||||
<hr/>
|
||||
<a onClick={this.deletePost} className="delete-post-link"><Icon name="close"/> Delete Post</a>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ const PostNewForm = (props, context) => {
|
|||
return (
|
||||
<CanCreatePost>
|
||||
<div className="new-post-form">
|
||||
<h3 className="modal-form-title">New Post</h3>
|
||||
<NovaForm
|
||||
collection={Posts}
|
||||
currentUser={context.currentUser}
|
||||
|
|
|
@ -28,7 +28,7 @@ class PostItem extends Component {
|
|||
({PostEditForm} = Telescope.components);
|
||||
|
||||
const component = (
|
||||
<ModalTrigger component={<a className="edit-link">Edit</a>}>
|
||||
<ModalTrigger title="Edit Post" component={<a className="edit-link">Edit</a>}>
|
||||
<PostEditForm post={this.props.post}/>
|
||||
</ModalTrigger>
|
||||
);
|
||||
|
|
|
@ -48,6 +48,14 @@ class ModalTrigger extends Component {
|
|||
// };
|
||||
// }
|
||||
|
||||
renderHeader() {
|
||||
return (
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>{this.props.title}</Modal.Title>
|
||||
</Modal.Header>
|
||||
)
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
const triggerComponent = React.cloneElement(this.props.component, { onClick: this.openModal });
|
||||
|
@ -56,9 +64,7 @@ class ModalTrigger extends Component {
|
|||
<div className="modal-trigger">
|
||||
{triggerComponent}
|
||||
<Modal bsSize={this.props.size} show={this.state.modalIsOpen} onHide={this.closeModal}>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>Modal heading</Modal.Title>
|
||||
</Modal.Header>
|
||||
{this.props.title ? this.renderHeader() : null}
|
||||
<Modal.Body>
|
||||
<ContextPasser currentUser={this.context.currentUser} closeCallback={this.props.closeCallback}>
|
||||
{this.props.children}
|
||||
|
|
|
@ -56,7 +56,7 @@ class MoviesList extends Component {
|
|||
renderNew() {
|
||||
|
||||
const component = (
|
||||
<ModalTrigger label="Add Movie" className="button button--primary">
|
||||
<ModalTrigger title="Add Movie" label="Add Movie" className="button button--primary">
|
||||
<NewDocument collection={Movies} label="Add Movie" methodName="movies.create"/>
|
||||
</ModalTrigger>
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue