From cec53b595a50afc323942cb39f6414f351369676 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 31 Aug 2021 15:27:25 +0530 Subject: [PATCH] fix(cleanup): cleanup email account, bug fix for web_template.js and more --- frappe/core/doctype/doctype/doctype.json | 6 +- .../doctype/email_account/email_account.js | 12 -- .../doctype/email_account/email_account.json | 109 ++++++++++++------ frappe/public/js/frappe/utils/web_template.js | 5 +- frappe/public/scss/desk/page.scss | 4 +- frappe/website/doctype/web_page/web_page.js | 10 +- 6 files changed, 85 insertions(+), 61 deletions(-) diff --git a/frappe/core/doctype/doctype/doctype.json b/frappe/core/doctype/doctype/doctype.json index 6a427f71e1..63e0426eb3 100644 --- a/frappe/core/doctype/doctype/doctype.json +++ b/frappe/core/doctype/doctype/doctype.json @@ -28,6 +28,7 @@ "sb1", "autoname", "name_case", + "allow_rename", "column_break_15", "description", "documentation", @@ -39,7 +40,6 @@ "column_break_23", "hide_toolbar", "allow_copy", - "allow_rename", "allow_import", "allow_events_in_timeline", "allow_auto_repeat", @@ -276,7 +276,7 @@ "oldfieldtype": "Check" }, { - "default": "0", + "default": "1", "fieldname": "allow_rename", "fieldtype": "Check", "label": "Allow Rename", @@ -635,7 +635,7 @@ "link_fieldname": "reference_doctype" } ], - "modified": "2021-06-17 23:31:44.974199", + "modified": "2021-08-31 15:26:19.077164", "modified_by": "Administrator", "module": "Core", "name": "DocType", diff --git a/frappe/email/doctype/email_account/email_account.js b/frappe/email/doctype/email_account/email_account.js index 83896e0af7..277bf43eb6 100644 --- a/frappe/email/doctype/email_account/email_account.js +++ b/frappe/email/doctype/email_account/email_account.js @@ -151,18 +151,6 @@ frappe.ui.form.on("Email Account", { callback: function (r) { if (r.message) { frm.events.set_domain_fields(frm, r.message); - } else { - frm.set_value("domain", ""); - frappe.confirm(__('Email Domain not configured for this account, Create one?'), - function () { - frappe.model.with_doctype("Email Domain", function() { - frappe.route_options = { email_id: frm.doc.email_id }; - frappe.route_flags.return_to_email_account = 1; - var doc = frappe.model.get_new_doc("Email Domain"); - frappe.set_route("Form", "Email Domain", doc.name); - }); - } - ); } } }); diff --git a/frappe/email/doctype/email_account/email_account.json b/frappe/email/doctype/email_account/email_account.json index 6d811b801f..8cfd75d839 100644 --- a/frappe/email/doctype/email_account/email_account.json +++ b/frappe/email/doctype/email_account/email_account.json @@ -7,30 +7,34 @@ "document_type": "Setup", "engine": "InnoDB", "field_order": [ + "account_section", "email_id", - "login_id_is_different", - "login_id", + "email_account_name", + "column_break_3", + "domain", + "service", + "authentication_column", "password", "awaiting_password", "ascii_encode_password", - "email_account_name", - "email_settings", - "domain", - "service", + "column_break_10", + "login_id_is_different", + "login_id", "mailbox_settings", "enable_incoming", - "use_imap", - "email_server", - "use_ssl", - "append_emails_to_sent_folder", - "incoming_port", - "attachment_limit", - "append_to", "default_incoming", + "use_imap", + "use_ssl", + "email_server", + "incoming_port", + "column_break_18", + "attachment_limit", "email_sync_option", "initial_sync_count", - "create_contact", "section_break_12", + "append_emails_to_sent_folder", + "append_to", + "create_contact", "enable_automatic_linking", "section_break_13", "notify_if_unreplied", @@ -42,6 +46,7 @@ "use_tls", "use_ssl_for_outgoing", "smtp_port", + "column_break_38", "default_outgoing", "always_use_account_email_id_as_sender", "always_use_account_name_as_sender_name", @@ -80,7 +85,7 @@ "fieldtype": "Check", "hide_days": 1, "hide_seconds": 1, - "label": "Use Different Email Login ID" + "label": "Use different login" }, { "depends_on": "login_id_is_different", @@ -122,12 +127,6 @@ "label": "Email Account Name", "unique": 1 }, - { - "fieldname": "email_settings", - "fieldtype": "Section Break", - "hide_days": 1, - "hide_seconds": 1 - }, { "depends_on": "eval:!doc.service", "fieldname": "domain", @@ -136,7 +135,7 @@ "hide_seconds": 1, "in_list_view": 1, "in_standard_filter": 1, - "label": "Domain", + "label": "Domain (optional)", "options": "Email Domain" }, { @@ -145,18 +144,18 @@ "fieldtype": "Select", "hide_days": 1, "hide_seconds": 1, - "label": "Service", + "label": "Service (optional)", "options": "\nGMail\nSendgrid\nSparkPost\nYahoo Mail\nOutlook.com\nYandex.Mail" }, { "fieldname": "mailbox_settings", "fieldtype": "Section Break", "hide_days": 1, - "hide_seconds": 1 + "hide_seconds": 1, + "label": "Incoming (POP/IMAP) Settings" }, { "default": "0", - "description": "Check this to pull emails from your mailbox", "fieldname": "enable_incoming", "fieldtype": "Check", "hide_days": 1, @@ -237,6 +236,7 @@ }, { "default": "250", + "depends_on": "eval: doc.enable_incoming", "description": "Total number of emails to sync in initial sync process ", "fieldname": "initial_sync_count", "fieldtype": "Select", @@ -248,7 +248,7 @@ { "depends_on": "enable_incoming", "fieldname": "section_break_13", - "fieldtype": "Section Break", + "fieldtype": "Column Break", "hide_days": 1, "hide_seconds": 1 }, @@ -282,7 +282,8 @@ "fieldname": "outgoing_mail_settings", "fieldtype": "Section Break", "hide_days": 1, - "hide_seconds": 1 + "hide_seconds": 1, + "label": "Outgoing (SMTP) Settings" }, { "default": "0", @@ -336,22 +337,20 @@ { "default": "0", "depends_on": "enable_outgoing", - "description": "Uses the Email Address mentioned in this Account as the Sender for all emails sent using this Account. ", "fieldname": "always_use_account_email_id_as_sender", "fieldtype": "Check", "hide_days": 1, "hide_seconds": 1, - "label": "Always use Account's Email Address as Sender" + "label": "Always use this email address as sender address" }, { "default": "0", "depends_on": "enable_outgoing", - "description": "Uses the Email Address Name mentioned in this Account as the Sender's Name for all emails sent using this Account.", "fieldname": "always_use_account_name_as_sender_name", "fieldtype": "Check", "hide_days": 1, "hide_seconds": 1, - "label": "Always use Account's Name as Sender's Name" + "label": "Always use this name as sender name" }, { "default": "1", @@ -379,10 +378,13 @@ "label": "Disable SMTP server authentication" }, { + "collapsible": 1, + "collapsible_depends_on": "add_signature", "fieldname": "signature_section", "fieldtype": "Section Break", "hide_days": 1, - "hide_seconds": 1 + "hide_seconds": 1, + "label": "Signature" }, { "default": "0", @@ -401,10 +403,13 @@ "label": "Signature" }, { + "collapsible": 1, + "collapsible_depends_on": "enable_auto_reply", "fieldname": "auto_reply", "fieldtype": "Section Break", "hide_days": 1, - "hide_seconds": 1 + "hide_seconds": 1, + "label": "Auto Reply" }, { "default": "0", @@ -424,17 +429,20 @@ "label": "Auto Reply Message" }, { + "collapsible": 1, + "collapsible_depends_on": "eval:frappe.utils.html2text(doc.footer || '')!=''", "fieldname": "set_footer", "fieldtype": "Section Break", "hide_days": 1, - "hide_seconds": 1 + "hide_seconds": 1, + "label": "Footer" }, { "fieldname": "footer", "fieldtype": "Text Editor", "hide_days": 1, "hide_seconds": 1, - "label": "Footer" + "label": "Footer Content" }, { "fieldname": "uidvalidity", @@ -477,7 +485,8 @@ "fieldname": "section_break_12", "fieldtype": "Section Break", "hide_days": 1, - "hide_seconds": 1 + "hide_seconds": 1, + "label": "Document Linking" }, { "default": "0", @@ -527,12 +536,38 @@ "fieldname": "brand_logo", "fieldtype": "Attach Image", "label": "Brand Logo" + }, + { + "fieldname": "authentication_column", + "fieldtype": "Section Break", + "label": "Authentication" + }, + { + "fieldname": "column_break_10", + "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_18", + "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_38", + "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "account_section", + "fieldtype": "Section Break", + "label": "Account" } ], "icon": "fa fa-inbox", "index_web_pages_for_search": 1, "links": [], - "modified": "2021-01-21 10:05:24.820597", + "modified": "2021-08-31 15:23:25.714366", "modified_by": "Administrator", "module": "Email", "name": "Email Account", diff --git a/frappe/public/js/frappe/utils/web_template.js b/frappe/public/js/frappe/utils/web_template.js index 64cf17b2d7..e6b43e2633 100644 --- a/frappe/public/js/frappe/utils/web_template.js +++ b/frappe/public/js/frappe/utils/web_template.js @@ -31,8 +31,6 @@ function open_web_template_values_editor(template, current_values = {}) { let current_table = null; for (let df of doc.fields) { if (current_table) { - current_table.fields = current_table.fields || []; - if (df.fieldtype != 'Table Break') { current_table.fields.push(df); } else { @@ -44,6 +42,9 @@ function open_web_template_values_editor(template, current_values = {}) { } else { table_fields.push(df); current_table = df; + + // start capturing fields in current_table till the next table break + current_table.fields = []; } } diff --git a/frappe/public/scss/desk/page.scss b/frappe/public/scss/desk/page.scss index 65d535facc..339dd755d0 100644 --- a/frappe/public/scss/desk/page.scss +++ b/frappe/public/scss/desk/page.scss @@ -66,7 +66,7 @@ padding: 4px 10px; } .btn-primary, .btn-secondary { - min-width: 70px; + min-width: 40px; } .custom-btn-group { display: inline-flex; @@ -183,4 +183,4 @@ .page-only-label { margin-top: var(--margin-xs); text-align: center; -} \ No newline at end of file +} diff --git a/frappe/website/doctype/web_page/web_page.js b/frappe/website/doctype/web_page/web_page.js index a58c854e5c..070d1b2ad5 100644 --- a/frappe/website/doctype/web_page/web_page.js +++ b/frappe/website/doctype/web_page/web_page.js @@ -2,11 +2,6 @@ // MIT License. See license.txt frappe.ui.form.on('Web Page', { - title: function(frm) { - if (frm.doc.title && !frm.doc.route) { - frm.set_value('route', frappe.scrub(frm.doc.title, '-')); - } - }, layout: function(frm) { if (frm.is_new()) { if (frm.doc.insert_code) { @@ -28,6 +23,11 @@ frappe.ui.form.on('Web Page', { }; }); }, + validate: function(frm) { + if (frm.doc.title && !frm.doc.route) { + frm.set_value('route', frappe.scrub(frm.doc.title, '-')); + } + }, refresh: function(frm) { if (frm.doc.template_path) { frm.set_read_only();