Skip to content

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

Make the default template the default selection on the campaign form

Kailash Nadh5ff0e446edbe
diff --git a/frontend/my/src/Campaign.js b/frontend/my/src/Campaign.js
index 12bc0ad8..90c30229 100644
--- a/frontend/my/src/Campaign.js
+++ b/frontend/my/src/Campaign.js
@@ -321,7 +321,7 @@ class TheFormDef extends React.PureComponent {
</Form.Item>
<Form.Item {...formItemLayout} label="Template" extra="Template">
{getFieldDecorator("template_id", {
- initialValue: record.template_id ? record.template_id : (this.props.data[cs.ModelTemplates].length === 1 ? this.props.data[cs.ModelTemplates][0].id : undefined),
+ initialValue: record.template_id ? record.template_id : (this.props.data[cs.ModelTemplates].length > 0 ? this.props.data[cs.ModelTemplates].filter(t => t.is_default)[0].id : undefined),
rules: [{ required: true }]
})(
<Select disabled={ this.props.formDisabled }>