Merge pull request #278 from pateljannat/profile-restrictions
This commit is contained in:
@@ -177,6 +177,26 @@ jinja = {
|
|||||||
# "school.plugins.LiveCodeExtension"
|
# "school.plugins.LiveCodeExtension"
|
||||||
#]
|
#]
|
||||||
|
|
||||||
|
profile_mandatory_fields = [
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"user_image",
|
||||||
|
"bio",
|
||||||
|
"linkedin",
|
||||||
|
"education",
|
||||||
|
"work_experience",
|
||||||
|
"skill",
|
||||||
|
"preferred_functions",
|
||||||
|
"preferred_industries",
|
||||||
|
"dream_companies",
|
||||||
|
"attire",
|
||||||
|
"collaboration",
|
||||||
|
"role",
|
||||||
|
"location_preference",
|
||||||
|
"time",
|
||||||
|
"company_type"
|
||||||
|
]
|
||||||
|
|
||||||
## Markdown Macros for Lessons
|
## Markdown Macros for Lessons
|
||||||
school_markdown_macro_renderers = {
|
school_markdown_macro_renderers = {
|
||||||
"Exercise": "school.plugins.exercise_renderer",
|
"Exercise": "school.plugins.exercise_renderer",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "hash",
|
||||||
"creation": "2021-12-07 12:20:37.143096",
|
"creation": "2021-12-07 12:20:37.143096",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -61,10 +62,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-14 11:42:24.844113",
|
"modified": "2021-12-21 10:05:43.377876",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Certification",
|
"name": "Certification",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "hash",
|
||||||
"creation": "2021-12-07 12:15:46.078717",
|
"creation": "2021-12-07 12:15:46.078717",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -74,10 +75,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-10 12:12:58.827429",
|
"modified": "2021-12-21 09:58:42.343823",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Education Detail",
|
"name": "Education Detail",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-14 14:02:46.474260",
|
"modified": "2021-12-21 09:34:35.018280",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Function",
|
"name": "Function",
|
||||||
@@ -37,6 +37,16 @@
|
|||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "All",
|
||||||
|
"select": 1,
|
||||||
|
"share": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-14 14:38:10.405473",
|
"modified": "2021-12-21 09:35:20.443192",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Industry",
|
"name": "Industry",
|
||||||
@@ -37,6 +37,16 @@
|
|||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "All",
|
||||||
|
"select": 1,
|
||||||
|
"share": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
"mentor_request_status_update",
|
"mentor_request_status_update",
|
||||||
"search_settings_section",
|
"search_settings_section",
|
||||||
"show_search",
|
"show_search",
|
||||||
"search_placeholder"
|
"search_placeholder",
|
||||||
|
"profile_restrictions_section",
|
||||||
|
"force_profile_completion"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -65,12 +67,23 @@
|
|||||||
"fieldname": "search_placeholder",
|
"fieldname": "search_placeholder",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Search Field Placeholder"
|
"label": "Search Field Placeholder"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "profile_restrictions_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Profile"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "force_profile_completion",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Force users to complete their Profile"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-11-25 14:12:21.514922",
|
"modified": "2021-12-20 12:11:26.628925",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
@@ -3,8 +3,18 @@
|
|||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
# import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class LMSSettings(Document):
|
class LMSSettings(Document):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def check_profile_restriction():
|
||||||
|
force_profile_completion = frappe.db.get_single_value("LMS Settings", "force_profile_completion")
|
||||||
|
user = frappe.db.get_value("User", frappe.session.user, ["profile_complete", "username"], as_dict=True)
|
||||||
|
return {
|
||||||
|
"restrict": force_profile_completion and not user.profile_complete,
|
||||||
|
"username": user.username,
|
||||||
|
"prefix": frappe.get_hooks("profile_url_prefix")[0] or "/users/"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "hash",
|
||||||
"creation": "2021-12-14 14:42:48.823215",
|
"creation": "2021-12-14 14:42:48.823215",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -12,19 +13,20 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "function",
|
"fieldname": "function",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"ignore_user_permissions": 1,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Function",
|
"label": "Function",
|
||||||
"options": "Function",
|
"options": "Function"
|
||||||
"reqd": 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-14 14:42:48.823215",
|
"modified": "2021-12-21 10:07:01.448239",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Preferred Function",
|
"name": "Preferred Function",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "hash",
|
||||||
"creation": "2021-12-14 14:44:06.808797",
|
"creation": "2021-12-14 14:44:06.808797",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -21,10 +22,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-14 14:44:21.215262",
|
"modified": "2021-12-21 10:07:14.537564",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Preferred Industry",
|
"name": "Preferred Industry",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-12 10:02:39.584832",
|
"modified": "2021-12-21 09:35:44.265910",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Skill",
|
"name": "Skill",
|
||||||
@@ -37,6 +37,16 @@
|
|||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "All",
|
||||||
|
"select": 1,
|
||||||
|
"share": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "hash",
|
||||||
"creation": "2021-12-07 12:22:44.139341",
|
"creation": "2021-12-07 12:22:44.139341",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -21,10 +22,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-13 14:42:43.962186",
|
"modified": "2021-12-21 09:59:31.631132",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Skills",
|
"name": "Skills",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
|
"autoname": "hash",
|
||||||
"creation": "2021-12-07 12:17:49.571045",
|
"creation": "2021-12-07 12:17:49.571045",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"editable_grid": 1,
|
"editable_grid": 1,
|
||||||
@@ -70,10 +71,11 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-09 16:25:48.104205",
|
"modified": "2021-12-21 09:58:56.254035",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Work Experience",
|
"name": "Work Experience",
|
||||||
|
"naming_rule": "Random",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [],
|
"permissions": [],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ frappe.ready(function () {
|
|||||||
frappe.web_form.validate = () => {
|
frappe.web_form.validate = () => {
|
||||||
let information_missing;
|
let information_missing;
|
||||||
const data = frappe.web_form.get_values();
|
const data = frappe.web_form.get_values();
|
||||||
data.work_experience.forEach(exp => {
|
data.work_experience && data.work_experience.length && data.work_experience.forEach(exp => {
|
||||||
if (!exp.current && !exp.to_date) {
|
if (!exp.current && !exp.to_date) {
|
||||||
information_missing = true
|
information_missing = true
|
||||||
frappe.msgprint('To Date is mandatory in Work Experience.');
|
frappe.msgprint('To Date is mandatory in Work Experience.');
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"is_standard": 1,
|
"is_standard": 1,
|
||||||
"login_required": 1,
|
"login_required": 1,
|
||||||
"max_attachment_size": 0,
|
"max_attachment_size": 0,
|
||||||
"modified": "2021-12-14 16:35:24.751439",
|
"modified": "2021-12-21 11:05:56.505121",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "profile",
|
"name": "profile",
|
||||||
@@ -330,12 +330,12 @@
|
|||||||
"fieldname": "preferred_location",
|
"fieldname": "preferred_location",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"label": "Preferred Location",
|
"label": "Preferred Locations",
|
||||||
"max_length": 0,
|
"max_length": 0,
|
||||||
"max_value": 0,
|
"max_value": 0,
|
||||||
"options": "",
|
"options": "",
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"show_in_filter": 0
|
"show_in_filter": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -411,7 +411,7 @@
|
|||||||
"label": "Location Preference",
|
"label": "Location Preference",
|
||||||
"max_length": 0,
|
"max_length": 0,
|
||||||
"max_value": 0,
|
"max_value": 0,
|
||||||
"options": "Travel to work\nOffice close to Home",
|
"options": "Travel\nOffice close to Home",
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"show_in_filter": 0
|
"show_in_filter": 0
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class CustomUser(User):
|
|||||||
super(CustomUser, self).validate()
|
super(CustomUser, self).validate()
|
||||||
self.validate_username_characters()
|
self.validate_username_characters()
|
||||||
self.validate_skills()
|
self.validate_skills()
|
||||||
|
self.validate_completion()
|
||||||
|
|
||||||
def validate_username_characters(self):
|
def validate_username_characters(self):
|
||||||
if len(self.username):
|
if len(self.username):
|
||||||
@@ -50,6 +51,12 @@ class CustomUser(User):
|
|||||||
if len(self.username) < 4:
|
if len(self.username) < 4:
|
||||||
frappe.throw(_("Username cannot be less than 4 characters"))
|
frappe.throw(_("Username cannot be less than 4 characters"))
|
||||||
|
|
||||||
|
def get_username_from_first_name(self):
|
||||||
|
return frappe.scrub(self.first_name) + str(random.randint(0, 99))
|
||||||
|
|
||||||
|
def remove_illegal_characters(self):
|
||||||
|
return re.sub("[^\w]+", "", self.username).strip("_")
|
||||||
|
|
||||||
def validate_skills(self):
|
def validate_skills(self):
|
||||||
unique_skills = []
|
unique_skills = []
|
||||||
for skill in self.skill:
|
for skill in self.skill:
|
||||||
@@ -60,12 +67,18 @@ class CustomUser(User):
|
|||||||
else:
|
else:
|
||||||
frappe.throw(_("Skills must be unique"))
|
frappe.throw(_("Skills must be unique"))
|
||||||
|
|
||||||
|
def validate_completion(self):
|
||||||
|
all_fields_have_value = True
|
||||||
|
if frappe.db.get_single_value("LMS Settings", "force_profile_completion"):
|
||||||
|
profile_mandatory_fields = frappe.get_hooks("profile_mandatory_fields")
|
||||||
|
docfields = frappe.get_meta(self.doctype).fields
|
||||||
|
|
||||||
def get_username_from_first_name(self):
|
for field in profile_mandatory_fields:
|
||||||
return frappe.scrub(self.first_name) + str(random.randint(0, 99))
|
if not self.get(field):
|
||||||
|
all_fields_have_value = False
|
||||||
|
break
|
||||||
|
|
||||||
def remove_illegal_characters(self):
|
self.profile_complete = all_fields_have_value
|
||||||
return re.sub("[^\w]+", "", self.username).strip("_")
|
|
||||||
|
|
||||||
def get_authored_courses(self) -> int:
|
def get_authored_courses(self) -> int:
|
||||||
"""Returns the number of courses authored by this user.
|
"""Returns the number of courses authored by this user.
|
||||||
|
|||||||
@@ -86,6 +86,17 @@ class LiveCodeExtension(PageExtension):
|
|||||||
"templates/livecode/extension_footer.html",
|
"templates/livecode/extension_footer.html",
|
||||||
context)
|
context)
|
||||||
|
|
||||||
|
def set_mandatory_fields_for_profile():
|
||||||
|
profile_form = frappe.get_doc("Web Form", "profile")
|
||||||
|
profile_mandatory_fields = frappe.get_hooks("profile_mandatory_fields")
|
||||||
|
for field in profile_form.web_form_fields:
|
||||||
|
field.reqd = 0
|
||||||
|
if field.fieldname in profile_mandatory_fields:
|
||||||
|
print(field.fieldname)
|
||||||
|
field.reqd = 1
|
||||||
|
|
||||||
|
profile_form.save()
|
||||||
|
|
||||||
def quiz_renderer(quiz_name):
|
def quiz_renderer(quiz_name):
|
||||||
quiz = frappe.get_doc("LMS Quiz", quiz_name)
|
quiz = frappe.get_doc("LMS Quiz", quiz_name)
|
||||||
context = dict(quiz=quiz)
|
context = dict(quiz=quiz)
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
frappe.ready(() => {
|
frappe.ready(() => {
|
||||||
|
hide_profile_for_guest_users();
|
||||||
|
});
|
||||||
|
|
||||||
|
const hide_profile_for_guest_users = () => {
|
||||||
if (frappe.session.user == "Guest") {
|
if (frappe.session.user == "Guest") {
|
||||||
var link_array = $('.nav-link').filter((i, elem) => $(elem).text().trim() === "My Profile");
|
var link_array = $('.nav-link').filter((i, elem) => $(elem).text().trim() === "My Profile");
|
||||||
link_array.length && $(link_array[0]).addClass("hide");
|
link_array.length && $(link_array[0]).addClass("hide");
|
||||||
}
|
}
|
||||||
})
|
};
|
||||||
|
|||||||
@@ -43,9 +43,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="course-buttons">
|
<div class="course-buttons">
|
||||||
{% if not course.disable_self_learning and not membership and not course.upcoming %}
|
{% if not course.disable_self_learning and not membership and not course.upcoming and not restriction.restrict %}
|
||||||
<div class="button wide-button start-learning is-primary join-batch" data-course="{{ course.name | urlencode }}">
|
<div class="button wide-button start-learning is-primary join-batch" data-course="{{ course.name | urlencode }}">
|
||||||
Start Learning
|
{{ _("Start Learning") }}
|
||||||
<img class="ml-2" src="/assets/school/icons/white-arrow.svg" />
|
<img class="ml-2" src="/assets/school/icons/white-arrow.svg" />
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
from school.lms.doctype.lms_settings.lms_settings import check_profile_restriction
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
@@ -20,6 +21,7 @@ def get_context(context):
|
|||||||
context.membership = membership
|
context.membership = membership
|
||||||
if context.course.upcoming:
|
if context.course.upcoming:
|
||||||
context.is_user_interested = get_user_interest(context.course.name)
|
context.is_user_interested = get_user_interest(context.course.name)
|
||||||
|
context.restriction = check_profile_restriction()
|
||||||
context.metatags = {
|
context.metatags = {
|
||||||
"title": course.title,
|
"title": course.title,
|
||||||
"image": course.image,
|
"image": course.image,
|
||||||
|
|||||||
@@ -9,9 +9,16 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="common-page-style">
|
<div class="common-page-style">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
{% if restriction.restrict %}
|
||||||
|
{% set site_link = "<a href='/edit-profile'> profile </a>" %}
|
||||||
|
<div class="empty-state">
|
||||||
|
<div class="course-home-headings text-center mb-0" style="color: inherit;">{{ _("You haven't completed your profile.") }}</div>
|
||||||
|
<p class="small text-center">{{ _("Complete your {0} to access the courses.").format(site_link) }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
{% include "school/templates/search_course/search_course.html" %}
|
{% include "school/templates/search_course/search_course.html" %}
|
||||||
|
|
||||||
<div class="course-list">
|
<div class="course-list">
|
||||||
{% set title = _("Live Courses") %}
|
{% set title = _("Live Courses") %}
|
||||||
{% set courses = live_courses %}
|
{% set courses = live_courses %}
|
||||||
@@ -23,6 +30,7 @@
|
|||||||
{% set classes = "upcoming-courses mt-10" %}
|
{% set classes = "upcoming-courses mt-10" %}
|
||||||
{% include "school/templates/course_list.html" %}
|
{% include "school/templates/course_list.html" %}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
from school.lms.doctype.lms_settings.lms_settings import check_profile_restriction
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
context.live_courses, context.upcoming_courses = get_courses()
|
context.live_courses, context.upcoming_courses = get_courses()
|
||||||
|
context.restriction = check_profile_restriction()
|
||||||
context.metatags = {
|
context.metatags = {
|
||||||
"title": "All Courses",
|
"title": "All Courses",
|
||||||
"image": frappe.db.get_single_value("Website Settings", "banner_image"),
|
"image": frappe.db.get_single_value("Website Settings", "banner_image"),
|
||||||
|
|||||||
@@ -290,12 +290,16 @@
|
|||||||
<div class="profile-card-row">
|
<div class="profile-card-row">
|
||||||
<div class="institute-name"> {{ edu.institution_name }} </div>
|
<div class="institute-name"> {{ edu.institution_name }} </div>
|
||||||
<div class="profile-item"> {{ edu.degree_type }} <span></span> {{ edu.major }}
|
<div class="profile-item"> {{ edu.degree_type }} <span></span> {{ edu.major }}
|
||||||
{% if not member.hide_private %} <span></span>
|
{% if not member.hide_private %}
|
||||||
<!-- {% if edu.grade_type %} {{ edu.grade_type }} {% endif %} -->
|
<!-- {% if edu.grade_type %} {{ edu.grade_type }} {% endif %} -->
|
||||||
{% if edu.grade %} {{ edu.grade }} {% endif %}
|
{% if edu.grade %} <span></span> {{ edu.grade }} {% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div> {{ frappe.utils.format_date(edu.start_date, "MMM YYYY") }} - {{ frappe.utils.format_date(edu.end_date, "MMM YYYY") }} </div>
|
<div>
|
||||||
|
{% if edu.start_date %}
|
||||||
|
{{ frappe.utils.format_date(edu.start_date, "MMM YYYY") }} -
|
||||||
|
{% endif %}
|
||||||
|
{{ frappe.utils.format_date(edu.end_date, "MMM YYYY") }} </div>
|
||||||
<div> {{ edu.location }} </div>
|
<div> {{ edu.location }} </div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Reference in New Issue
Block a user