Merge pull request #1028 from pateljannat/fix-signup-customisations

fix: signup conditions
This commit is contained in:
Jannat Patel
2024-09-23 19:12:29 +05:30
committed by GitHub
3 changed files with 14 additions and 59 deletions

View File

@@ -23,15 +23,9 @@
"show_emails",
"signup_settings_tab",
"signup_settings_section",
"terms_of_use",
"terms_page",
"user_category",
"column_break_9",
"privacy_policy",
"privacy_policy_page",
"column_break_12",
"cookie_policy",
"cookie_policy_page",
"custom_signup_content",
"user_category",
"sidebar_tab",
"items_in_sidebar_section",
"courses",
@@ -92,60 +86,14 @@
"fieldtype": "Column Break",
"label": "Show Tab in Batch"
},
{
"default": "0",
"fieldname": "terms_of_use",
"fieldtype": "Check",
"label": "Show Terms of Use on Signup"
},
{
"depends_on": "terms_of_use",
"fieldname": "terms_page",
"fieldtype": "Link",
"label": "Terms of Use Page",
"mandatory_depends_on": "terms_of_use",
"options": "Web Page"
},
{
"fieldname": "signup_settings_section",
"fieldtype": "Section Break"
},
{
"default": "0",
"fieldname": "privacy_policy",
"fieldtype": "Check",
"label": "Show Privacy Policy on Signup"
},
{
"depends_on": "privacy_policy",
"fieldname": "privacy_policy_page",
"fieldtype": "Link",
"label": "Privacy Policy Page",
"mandatory_depends_on": "privacy_policy",
"options": "Web Page"
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_9",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "cookie_policy",
"fieldtype": "Check",
"label": "Show Cookie Policy on Signup"
},
{
"depends_on": "cookie_policy",
"fieldname": "cookie_policy_page",
"fieldtype": "Link",
"label": "Cookie Policy Page",
"mandatory_depends_on": "cookie_policy",
"options": "Web Page"
},
{
"default": "0",
"fieldname": "user_category",
@@ -378,12 +326,17 @@
"fieldtype": "Table",
"label": "Sidebar Items",
"options": "LMS Sidebar Item"
},
{
"fieldname": "custom_signup_content",
"fieldtype": "HTML Editor",
"label": "Custom Signup Content"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-08-13 19:02:58.714080",
"modified": "2024-09-23 17:57:01.350020",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Settings",

View File

@@ -227,8 +227,7 @@ def assignment_renderer(detail):
def show_custom_signup():
if frappe.db.get_single_value(
"LMS Settings", "terms_of_use"
) or frappe.db.get_single_value("LMS Settings", "privacy_policy"):
settings = frappe.get_single("LMS Settings")
if settings.custom_signup_content or settings.user_category:
return "lms/templates/signup-form.html"
return "frappe/templates/signup.html"

View File

@@ -1,3 +1,4 @@
{% set custom_signup_content = frappe.db.get_single_value("LMS Settings", "custom_signup_content") %}
<form class="signup-form" role="form">
<div class="page-card-body">
<div class="form-group">
@@ -31,6 +32,7 @@
</div>
{% endif %}
{% if custom_signup_content %}
<div class="form-group">
<div class="checkbox">
<label>
@@ -39,11 +41,12 @@
data-fieldtype="Check" data-fieldname="terms" id="signup-terms" required>
</span>
<span class="label-area">
{{ _("I have read and agree to your {0}").format(get_signup_optin_checks()) }}
{{ custom_signup_content }}
</span>
</label>
</div>
</div>
{% endif %}
</div>
<div class="page-card-actions">
<button class="btn btn-sm btn-primary btn-block btn-signup"