From 9f2cba49ee6af3942cfb2fc2d68d83786a323d23 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 23 Dec 2021 19:58:42 +0530 Subject: [PATCH] feat: hide primary contact from profile --- school/lms/doctype/lms_settings/lms_settings.json | 9 ++++++++- school/www/profiles/profile.html | 4 ++-- school/www/profiles/profile.py | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/school/lms/doctype/lms_settings/lms_settings.json b/school/lms/doctype/lms_settings/lms_settings.json index 75506188..72083701 100644 --- a/school/lms/doctype/lms_settings/lms_settings.json +++ b/school/lms/doctype/lms_settings/lms_settings.json @@ -7,6 +7,7 @@ "field_order": [ "livecode_url", "email_sender", + "hide_primary_contact", "column_break_2", "force_profile_completion", "show_search", @@ -82,12 +83,18 @@ "label": "Terms of Use Page", "mandatory_depends_on": "terms_of_use", "options": "Web Page" + }, + { + "default": "0", + "fieldname": "hide_primary_contact", + "fieldtype": "Check", + "label": "Hide Primary Contact on Profile Page" } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2021-12-21 16:01:48.260411", + "modified": "2021-12-23 19:49:02.194513", "modified_by": "Administrator", "module": "LMS", "name": "LMS Settings", diff --git a/school/www/profiles/profile.html b/school/www/profiles/profile.html index 64e73b81..07ab6f03 100644 --- a/school/www/profiles/profile.html +++ b/school/www/profiles/profile.html @@ -239,11 +239,11 @@
{{ _("Contact") }}
- {% if not member.hide_private %} + {% if not member.hide_private and not hide_primary_contact %} {{ member.email }} {% endif %} - {% if member.mobile_no and not member.hide_private %} + {% if member.mobile_no and not member.hide_private and not hide_primary_contact %} {{ member.mobile_no }} diff --git a/school/www/profiles/profile.py b/school/www/profiles/profile.py index 17d4bb81..60b74143 100644 --- a/school/www/profiles/profile.py +++ b/school/www/profiles/profile.py @@ -17,6 +17,7 @@ def get_context(context): except: context.template = "www/404.html" return + context.hide_primary_contact = frappe.db.get_single_value("LMS Settings", "hide_primary_contact") context.profile_tabs = get_profile_tabs(context.member) def get_profile_tabs(user):