feat: web pages for sidebar
This commit is contained in:
@@ -434,12 +434,12 @@ def get_sidebar_settings():
|
||||
for item in items:
|
||||
sidebar_items[item] = lms_settings.get(item)
|
||||
|
||||
if lms_settings.show_navbar_items:
|
||||
nav_items = frappe.get_all(
|
||||
"Top Bar Item",
|
||||
["label", "url"],
|
||||
{"parenttype": "Website Settings", "parentfield": "top_bar_items"},
|
||||
if len(lms_settings.sidebar_items):
|
||||
web_pages = frappe.get_all(
|
||||
"LMS Sidebar Item",
|
||||
{"parenttype": "LMS Settings", "parentfield": "sidebar_items"},
|
||||
["web_page", "route", "title", "icon"],
|
||||
)
|
||||
sidebar_items.nav_items = nav_items
|
||||
sidebar_items.web_pages = web_pages
|
||||
|
||||
return sidebar_items
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
"statistics",
|
||||
"notifications",
|
||||
"section_break_qlss",
|
||||
"show_navbar_items",
|
||||
"sidebar_items",
|
||||
"mentor_request_tab",
|
||||
"mentor_request_section",
|
||||
"mentor_request_creation",
|
||||
@@ -422,16 +422,16 @@
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "show_navbar_items",
|
||||
"fieldtype": "Check",
|
||||
"label": "Show Navbar Items"
|
||||
"fieldname": "sidebar_items",
|
||||
"fieldtype": "Table",
|
||||
"label": "Sidebar Items",
|
||||
"options": "LMS Sidebar Item"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2024-05-28 18:29:31.609637",
|
||||
"modified": "2024-05-31 20:17:07.362088",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Settings",
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"web_page",
|
||||
"route",
|
||||
"column_break_glmh",
|
||||
"title",
|
||||
"icon"
|
||||
"column_break_glmh",
|
||||
"icon",
|
||||
"route"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -19,48 +19,43 @@
|
||||
{
|
||||
"fieldname": "icon",
|
||||
"fieldtype": "Data",
|
||||
"label": "Icon"
|
||||
"in_list_view": 1,
|
||||
"label": "Icon",
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "web_page",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Web Page",
|
||||
"options": "Web Page"
|
||||
"options": "Web Page",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "web_page.route",
|
||||
"fieldname": "route",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Route"
|
||||
},
|
||||
{
|
||||
"fetch_from": "web_page.title",
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Title"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2024-05-29 17:14:30.525055",
|
||||
"modified": "2024-05-31 20:19:14.629097",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Sidebar Item",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"permissions": [],
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
|
||||
@@ -646,14 +646,16 @@ def handle_notifications(doc, method):
|
||||
|
||||
def create_notification_log(doc, topic):
|
||||
users = []
|
||||
print(topic.reference_doctype == "Course Lesson")
|
||||
if topic.reference_doctype == "Course Lesson":
|
||||
course = frappe.db.get_value("Course Lesson", topic.reference_docname, "course")
|
||||
course_title = frappe.db.get_value("LMS Course", course, "title")
|
||||
instructors = frappe.db.get_all(
|
||||
"Course Instructor", {"parent": course}, pluck="instructor"
|
||||
)
|
||||
users.append(topic.owner)
|
||||
|
||||
if doc.owner != topic.owner:
|
||||
users.append(topic.owner)
|
||||
|
||||
users += instructors
|
||||
subject = _("New reply on the topic {0} in course {1}").format(
|
||||
topic.title, course_title
|
||||
|
||||
Reference in New Issue
Block a user