Переглянути джерело

fix: Webform Misc Fix (backport #17642) (#17746)

Co-authored-by: Shariq Ansari <30859809+shariquerik@users.noreply.github.com>
version-14
mergify[bot] 2 роки тому
committed by GitHub
джерело
коміт
86f9fbcc71
Не вдалося знайти GPG ключ що відповідає даному підпису Ідентифікатор GPG ключа: 4AEE18F83AFDEB23
6 змінених файлів з 14 додано та 27 видалено
  1. +4
    -10
      cypress/integration/web_form.js
  2. +3
    -3
      frappe/public/js/frappe/web_form/web_form.js
  3. +1
    -1
      frappe/website/doctype/web_form/templates/web_form.html
  4. +1
    -0
      frappe/website/doctype/web_form/test_records.json
  5. +1
    -10
      frappe/website/doctype/web_form/web_form.json
  6. +4
    -3
      frappe/website/doctype/web_form/web_form.py

+ 4
- 10
cypress/integration/web_form.js Переглянути файл

@@ -20,19 +20,13 @@ context("Web Form", () => {
cy.get(".title-area .indicator-pill").contains("Published");
});

it("Open Web Form (Logged in User)", () => {
it("Open Web Form", () => {
cy.visit("/note");

cy.fill_field("title", "Note 1");
cy.get(".web-form-actions button").contains("Save").click();

cy.url().should("include", "/note/Note%201");

cy.visit("/note");
cy.url().should("include", "/note/Note%201");
});
cy.url().should("include", "/note/new");

it("Open Web Form (Guest)", () => {
cy.request("/api/method/logout");
cy.visit("/note");

@@ -226,8 +220,8 @@ context("Web Form", () => {
cy.visit("/note");
cy.url().should("include", "/note/list");

cy.get('.web-list-table tbody tr[id="Note 1"] .list-col-checkbox').click();
cy.get('.web-list-table tbody tr[id="Note 2"] .list-col-checkbox').click();
cy.get('.web-list-table tbody tr[id="Note 1"] .list-col-checkbox input').click();
cy.get('.web-list-table tbody tr[id="Note 2"] .list-col-checkbox input').click();
cy.get(".web-list-actions button:visible").contains("Delete").click({ force: true });

cy.get(".web-list-actions button").contains("Delete").should("not.be.visible");


+ 3
- 3
frappe/public/js/frappe/web_form/web_form.js Переглянути файл

@@ -293,9 +293,9 @@ export default class WebForm extends frappe.ui.FieldGroup {
// validation hack: get_values will check for missing data
let doc_values = super.get_values(this.allow_incomplete);

if (!doc_values) return;
if (!doc_values) return false;

if (window.saving) return;
if (window.saving) return false;
// TODO: remove this (used for payments app)
let for_payment = Boolean(this.accept_payment && !this.doc.paid);

@@ -383,6 +383,6 @@ export default class WebForm extends frappe.ui.FieldGroup {
}
}
window.location.href = path;
}, 1000);
}, 3000);
}
}

+ 1
- 1
frappe/website/doctype/web_form/templates/web_form.html Переглянути файл

@@ -42,7 +42,7 @@
</div>
</div>
<div class="web-form-body">
{% if introduction_text %}
{% if is_new and introduction_text %}
<div class="web-form-introduction">{{ introduction_text }}</div>
{% endif %}
<div class="web-form-wrapper"></div>


+ 1
- 0
frappe/website/doctype/web_form/test_records.json Переглянути файл

@@ -2,6 +2,7 @@
"allow_comments": 0,
"allow_edit": 1,
"allow_multiple": 1,
"show_list": 1,
"doc_type": "Event",
"docstatus": 0,
"doctype": "Web Form",


+ 1
- 10
frappe/website/doctype/web_form/web_form.json Переглянути файл

@@ -36,7 +36,6 @@
"button_label",
"column_break_29",
"success_message",
"route_to_success_link",
"success_url",
"list_settings_tab",
"list_setting_message",
@@ -101,13 +100,6 @@
"fieldtype": "Check",
"label": "Login Required"
},
{
"default": "0",
"depends_on": "eval:doc.login_required",
"fieldname": "route_to_success_link",
"fieldtype": "Check",
"label": "Route to Success Link"
},
{
"default": "0",
"depends_on": "login_required",
@@ -211,7 +203,6 @@
"label": "Success Message"
},
{
"depends_on": "route_to_success_link",
"description": "Go to this URL after completing the form",
"fieldname": "success_url",
"fieldtype": "Data",
@@ -325,7 +316,7 @@
"icon": "icon-edit",
"is_published_field": "published",
"links": [],
"modified": "2022-07-24 20:29:23.059834",
"modified": "2022-07-27 18:19:10.748079",
"modified_by": "Administrator",
"module": "Website",
"name": "Web Form",


+ 4
- 3
frappe/website/doctype/web_form/web_form.py Переглянути файл

@@ -172,6 +172,7 @@ def get_context(context):

if (
frappe.session.user != "Guest"
and self.login_required
and not self.allow_multiple
and not frappe.form_dict.name
and not frappe.form_dict.is_list
@@ -183,7 +184,7 @@ def get_context(context):
# Show new form when
# - User is Guest
# - Login not required
route_to_new = frappe.session.user == "Guest" and not self.login_required
route_to_new = frappe.session.user == "Guest" or not self.login_required
if not frappe.form_dict.is_new and route_to_new:
frappe.redirect(f"/{self.route}/new")

@@ -245,7 +246,7 @@ def get_context(context):
if self.breadcrumbs:
context.parents = frappe.safe_eval(self.breadcrumbs, {"_": _})

if frappe.form_dict.is_new:
if self.show_list and frappe.form_dict.is_new:
context.title = _("New {0}").format(context.title)

context.has_header = (frappe.form_dict.name or frappe.form_dict.is_new) and (
@@ -287,7 +288,7 @@ def get_context(context):
"route": f"{self.route}/{context.doc_name}",
}
)
context.title = _("Edit")
context.title = _("Editing {0}").format(context.title)
context.reference_doc.add_seen()
context.reference_doctype = context.reference_doc.doctype
context.reference_name = context.reference_doc.name


Завантаження…
Відмінити
Зберегти