Merge pull request #309 from pateljannat/privacy-policy-during-signup

This commit is contained in:
Jannat Patel
2022-02-23 17:12:12 +05:30
committed by GitHub
10 changed files with 55 additions and 37 deletions

View File

@@ -81,10 +81,10 @@
"in_preview": 0, "in_preview": 0,
"in_standard_filter": 0, "in_standard_filter": 0,
"insert_after": "country", "insert_after": "country",
"label": "Acceptance for Terms of Use", "label": "Acceptance for Terms of Use and/or Privacy Policy",
"length": 0, "length": 0,
"mandatory_depends_on": null, "mandatory_depends_on": null,
"modified": "2021-12-31 19:15:34.932908", "modified": "2021-12-31 19:15:34.932909",
"module": null, "module": null,
"name": "User-verify_terms", "name": "User-verify_terms",
"no_copy": 0, "no_copy": 0,

View File

@@ -41,7 +41,6 @@ class InviteRequest(Document):
} }
frappe.sendmail( frappe.sendmail(
recipients=self.invite_email, recipients=self.invite_email,
sender=frappe.db.get_single_value("LMS Settings", "email_sender"),
subject=subject, subject=subject,
header=[subject, "green"], header=[subject, "green"],
template = "lms_invite_request_approved", template = "lms_invite_request_approved",

View File

@@ -34,7 +34,6 @@ class LMSCourse(Document):
args["first_name"] = frappe.db.get_value("User", user.user, "first_name") args["first_name"] = frappe.db.get_value("User", user.user, "first_name")
email_args = frappe._dict( email_args = frappe._dict(
recipients = user.user, recipients = user.user,
sender = frappe.db.get_single_value("LMS Settings", "email_sender"),
subject = subject, subject = subject,
header = [subject, "green"], header = [subject, "green"],
template = "lms_course_interest", template = "lms_course_interest",

View File

@@ -5,15 +5,17 @@
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"livecode_url",
"email_sender",
"hide_primary_contact",
"column_break_2",
"force_profile_completion",
"show_search", "show_search",
"search_placeholder", "search_placeholder",
"column_break_2",
"force_profile_completion",
"livecode_url",
"signup_settings_section",
"terms_of_use", "terms_of_use",
"terms_page", "terms_page",
"column_break_12",
"privacy_policy",
"privacy_policy_page",
"mentor_request_section", "mentor_request_section",
"mentor_request_creation", "mentor_request_creation",
"mentor_request_status_update" "mentor_request_status_update"
@@ -37,12 +39,6 @@
"label": "Mentor Request Status Update Template", "label": "Mentor Request Status Update Template",
"options": "Email Template" "options": "Email Template"
}, },
{
"fieldname": "email_sender",
"fieldtype": "Data",
"label": "Senders Email Id",
"options": "Email"
},
{ {
"fieldname": "mentor_request_section", "fieldname": "mentor_request_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -84,17 +80,33 @@
"mandatory_depends_on": "terms_of_use", "mandatory_depends_on": "terms_of_use",
"options": "Web Page" "options": "Web Page"
}, },
{
"fieldname": "signup_settings_section",
"fieldtype": "Section Break",
"label": "Signup Settings"
},
{ {
"default": "0", "default": "0",
"fieldname": "hide_primary_contact", "fieldname": "privacy_policy",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Hide Primary Contact on Profile Page" "label": "Show Privacy Policy on Signup"
},
{
"depends_on": "privacy_policy",
"fieldname": "privacy_policy_page",
"fieldtype": "Link",
"label": "Privacy Policy Page",
"options": "Web Page"
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break"
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2021-12-23 19:49:02.194513", "modified": "2022-02-23 16:15:28.586903",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "LMS Settings", "name": "LMS Settings",
@@ -113,5 +125,6 @@
], ],
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [],
"track_changes": 1 "track_changes": 1
} }

View File

@@ -138,6 +138,7 @@ def assignment_renderer(detail):
return frappe.render_template("templates/assignment.html", {"id": detail.split("-")[0], "accept": accept}) return frappe.render_template("templates/assignment.html", {"id": detail.split("-")[0], "accept": accept})
def show_custom_signup(): def show_custom_signup():
if frappe.db.get_single_value("LMS Settings", "terms_of_use"): if (frappe.db.get_single_value("LMS Settings", "terms_of_use")
or frappe.db.get_single_value("LMS Settings", "privacy_policy")):
return "school/templates/signup-form.html" return "school/templates/signup-form.html"
return "frappe/templates/signup.html" return "frappe/templates/signup.html"

View File

@@ -1291,7 +1291,6 @@ pre {
display: flex; display: flex;
align-items: center; align-items: center;
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
margin-top: 1rem;
} }
.course-creators-card { .course-creators-card {

View File

@@ -10,7 +10,25 @@
<input type="email" id="signup_email" class="form-control" <input type="email" id="signup_email" class="form-control"
placeholder="{{ _('jane@example.com') }}" required> placeholder="{{ _('jane@example.com') }}" required>
</div> </div>
{% if frappe.db.get_single_value("LMS Settings", "terms_of_use") %} {% set terms_of_use = frappe.db.get_single_value("LMS Settings", "terms_of_use") %}
{% set privacy_policy = frappe.db.get_single_value("LMS Settings", "privacy_policy") %}
{% if terms_of_use or privacy_policy %}
{% if terms_of_use %}
{% set terms_page = frappe.db.get_single_value("LMS Settings", "terms_page") %}
{% set terms_page_route = frappe.db.get_value("Web Page", terms_page, "route") %}
{% set terms_link = "<a href='/" + terms_page_route +"'>" + _("Terms of Use") + "</a>" %}
{% endif %}
{% if privacy_policy %}
{% set privacy_policy_page = frappe.db.get_single_value("LMS Settings", "privacy_policy_page") %}
{% set privacy_page_route = frappe.db.get_value("Web Page", privacy_policy_page, "route") %}
{% set privacy_link = "<a href='/" + privacy_page_route +"'>" + _("Privacy Policy") + "</a>" %}
{% endif %}
{% set final_link = terms_link + _(" and ") + privacy_link if terms_of_use and privacy_policy else terms_link if terms_of_use else privacy_link %}
<div class="form-group"> <div class="form-group">
<div class="checkbox"> <div class="checkbox">
<label> <label>
@@ -19,10 +37,7 @@
data-fieldtype="Check" data-fieldname="terms" id="signup-terms" required> data-fieldtype="Check" data-fieldname="terms" id="signup-terms" required>
</span> </span>
<span class="label-area"> <span class="label-area">
{% set terms_page = frappe.db.get_single_value("LMS Settings", "terms_page") %} {{ _("I have read and agree to your {0}").format(final_link) }}
{% set terms_page_route = frappe.db.get_value("Web Page", terms_page, "route") %}
{% set terms_link = "<a href='/" + terms_page_route +"'> Terms of Use </a>" %}
{{ _("I have read and I agree to your {0}").format(terms_link) }}
</span> </span>
</label> </label>
<p class="help-box small text-muted"></p> <p class="help-box small text-muted"></p>

View File

@@ -121,14 +121,14 @@
{% endif %} {% endif %}
<div class="course-overlay-content"> <div class="course-overlay-content">
<div class="course-home-headings"> {{ course.title }} </div>
<div id="interest-alert" class="{% if not is_user_interested %} hide {% endif %}"> <div id="interest-alert" class="{% if not is_user_interested %} hide {% endif %}">
You have opted to be notified for this course. You will receive an email when the course becomes available. You have opted to be notified for this course. You will receive an email when the course becomes available.
</div> </div>
<div class="course-home-headings"> {{ course.title }} </div>
{% if get_lessons(course.name) | length %} {% if get_lessons(course.name) | length %}
<div class="mt-3"> <div class="mt-3 mb-4">
<img class="mr-3" src="/assets/school/icons/book.svg"> <img class="mr-3" src="/assets/school/icons/book.svg">
{{ get_lessons(course.name) | length }} {{ _("Lessons") }} {{ get_lessons(course.name) | length }} {{ _("Lessons") }}
</div> </div>

View File

@@ -209,7 +209,7 @@
{% endmacro %} {% endmacro %}
{% macro Contact(member) %} {% macro Contact(member) %}
{% if show_contacts_section %} {% if member.linkedin or member.medium or member.github %}
<div class="education-details"> <div class="education-details">
<div class="common-card-style profile-card"> <div class="common-card-style profile-card">
<div class="course-home-headings"> {{ _("Contact") }} </div> <div class="course-home-headings"> {{ _("Contact") }} </div>
@@ -232,6 +232,7 @@
<img src="/assets/school/icons/github.svg"> {{ member.github.split("/")[-1] }} <img src="/assets/school/icons/github.svg"> {{ member.github.split("/")[-1] }}
</a> </a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -17,17 +17,8 @@ def get_context(context):
except: except:
context.template = "www/404.html" context.template = "www/404.html"
return return
context.hide_primary_contact = frappe.db.get_single_value("LMS Settings", "hide_primary_contact")
context.show_contacts_section = show_contacts_section(context.member, context.hide_primary_contact)
context.profile_tabs = get_profile_tabs(context.member) context.profile_tabs = get_profile_tabs(context.member)
def show_contacts_section(member, hide_primary_contact):
if member.github or member.linkedin or member.medium:
return True
if hide_primary_contact or member.hide_private:
return False
return True
def get_profile_tabs(user): def get_profile_tabs(user):
"""Returns the enabled ProfileTab objects. """Returns the enabled ProfileTab objects.