@saltcorn/markup
Advanced tools
Comparing version 0.3.2-beta.2 to 0.3.2
34
form.js
@@ -288,3 +288,18 @@ const { | ||
}, | ||
action({ action_label, confirm, action_style, action_size }) { | ||
action({ action_name, action_label, confirm, action_style, action_size }) { | ||
if (action_name && action_name.startsWith("Login with ")) { | ||
const method_label = action_name.replace("Login with ", ""); | ||
return a( | ||
{ | ||
href: `/auth/login-with/${method_label}`, | ||
//TODO get url through form.req to reduce coupling | ||
class: [ | ||
action_style !== "btn-link" && | ||
`btn ${action_style || "btn-primary"} ${action_size || ""}`, | ||
], | ||
}, | ||
action_label || action_name | ||
); | ||
} | ||
const submitAttr = form.xhrSubmit | ||
@@ -297,3 +312,5 @@ ? 'onClick="ajaxSubmitForm(this)" type="button"' | ||
: `btn ${action_style || "btn-primary"} ${action_size || ""}` | ||
}">${text(form.submitLabel || action_label || "Save")}</button>`; | ||
}">${text( | ||
action_label || form.submitLabel || action_name || "Save" | ||
)}</button>`; | ||
}, | ||
@@ -304,3 +321,9 @@ }; | ||
const renderForm = (form, csrfToken) => { | ||
const renderForm = (form, csrfToken0) => { | ||
const csrfToken = | ||
csrfToken0 === false || csrfToken0 === "" | ||
? csrfToken0 | ||
: csrfToken0 || (form.req && form.req.csrfToken && form.req.csrfToken()); | ||
if (typeof form === "string") return form; | ||
if (form.isStateForm) { | ||
@@ -441,4 +464,7 @@ form.class += " px-4 py-3"; | ||
module.exports = contract( | ||
is.fun([is.class("Form"), is.or(is.str, is.eq(false))], is.str), | ||
is.fun( | ||
[is.or(is.str, is.class("Form")), is.maybe(is.or(is.str, is.eq(false)))], | ||
is.str | ||
), | ||
renderForm | ||
); |
{ | ||
"name": "@saltcorn/markup", | ||
"version": "0.3.2-beta.2", | ||
"version": "0.3.2", | ||
"description": "Markup for Saltcorn, open-source no-code platform", | ||
@@ -27,3 +27,3 @@ "homepage": "https://saltcorn.com", | ||
}, | ||
"gitHead": "d520cc9f2bfce236879dee252733c8206ecedbba" | ||
"gitHead": "58f9b796e2afa2f827062b987cf83c50d15129c2" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49353
1678