From 5ff0e446edbe515191cda9474f124c491b98bb13 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Tue, 27 Nov 2018 11:54:23 +0530 Subject: [PATCH] Make the default template the default selection on the campaign form --- frontend/my/src/Campaign.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/my/src/Campaign.js b/frontend/my/src/Campaign.js index 12bc0ad..90c3022 100644 --- a/frontend/my/src/Campaign.js +++ b/frontend/my/src/Campaign.js @@ -321,7 +321,7 @@ class TheFormDef extends React.PureComponent { {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 }] })(