fix: Webform Misc Fix (#17642)
This commit is contained in:
parent
2101a2d576
commit
0ce7f44d45
6 changed files with 14 additions and 27 deletions
|
|
@ -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.url().should("include", "/note/new");
|
||||
|
||||
cy.visit("/note");
|
||||
cy.url().should("include", "/note/Note%201");
|
||||
});
|
||||
|
||||
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");
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
"allow_comments": 0,
|
||||
"allow_edit": 1,
|
||||
"allow_multiple": 1,
|
||||
"show_list": 1,
|
||||
"doc_type": "Event",
|
||||
"docstatus": 0,
|
||||
"doctype": "Web Form",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue