Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix the preview button in the new template form

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