From 0cef55e0aa1816347fc628b7ac5c5a14f28d2747 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 25 Jun 2018 14:12:06 +0530 Subject: [PATCH] formTitle for new doc --- src/components/Form/Form.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Form/Form.vue b/src/components/Form/Form.vue index e3b66a53..386c2db7 100644 --- a/src/components/Form/Form.vue +++ b/src/components/Form/Form.vue @@ -4,7 +4,7 @@ v-if="shouldRenderForm" :doctype="doctype" :name="name" - :title="doc[meta.titleField]" + :title="formTitle" @save="save" />
@@ -23,6 +23,7 @@ import frappe from 'frappejs'; import FormLayout from './FormLayout'; import FormActions from './FormActions'; +import { _ } from 'frappejs/utils'; export default { name: 'Form', @@ -45,6 +46,12 @@ export default { }, shouldRenderForm() { return this.name && this.docLoaded; + }, + formTitle() { + if (this.doc._notInserted) { + return _('New {0}', _(this.doctype)); + } + return this.doc[this.meta.titleField]; } }, async created() {