Fix the preview button in the new template form

This commit is contained in:
Kailash Nadh 2018-10-26 12:29:46 +05:30
parent 0849dc491b
commit 9582e20cd7
1 changed files with 8 additions and 6 deletions

View File

@ -93,11 +93,13 @@ class CreateFormDef extends React.PureComponent {
<Input.TextArea autosize={{ minRows: 10, maxRows: 30 }} /> <Input.TextArea autosize={{ minRows: 10, maxRows: 30 }} />
)} )}
</Form.Item> </Form.Item>
<Form.Item {...formItemLayout} colon={ false } label="&nbsp;"> { this.props.form.getFieldValue("body") !== "" &&
<Button icon="search" onClick={ () => <Form.Item {...formItemLayout} colon={ false } label="&nbsp;">
this.handlePreview(this.props.form.getFieldValue("name"), this.props.form.getFieldValue("body")) <Button icon="search" onClick={ () =>
}>Preview</Button> this.handlePreview(this.props.form.getFieldValue("name"), this.props.form.getFieldValue("body"))
</Form.Item> }>Preview</Button>
</Form.Item>
}
</Form> </Form>
</Spin> </Spin>
<Row> <Row>
@ -111,7 +113,7 @@ class CreateFormDef extends React.PureComponent {
{ this.state.previewBody && { this.state.previewBody &&
<ModalPreview <ModalPreview
title={ this.state.previewName ? this.state.previewName : "Template preview" } title={ this.state.previewName ? this.state.previewName : "Template preview" }
previewURL={ cs.Routes.PreviewTemplate } previewURL={ cs.Routes.PreviewNewTemplate }
body={ this.state.previewBody } body={ this.state.previewBody }
onCancel={() => { onCancel={() => {
this.setState({ previewBody: null, previewName: null }) this.setState({ previewBody: null, previewName: null })