diff --git a/frontend/src/components/AppSidebar.vue b/frontend/src/components/AppSidebar.vue index 245d0544..eb2895e4 100644 --- a/frontend/src/components/AppSidebar.vue +++ b/frontend/src/components/AppSidebar.vue @@ -16,8 +16,8 @@ class="mx-2 my-0.5" /> -
-
+
+
{{ __('Web Pages') }} @@ -27,6 +27,14 @@
+
+ +
+ diff --git a/frontend/src/components/Controls/IconPicker.vue b/frontend/src/components/Controls/IconPicker.vue new file mode 100644 index 00000000..e69a5e74 --- /dev/null +++ b/frontend/src/components/Controls/IconPicker.vue @@ -0,0 +1,109 @@ + + diff --git a/frontend/src/components/Modals/PageModal.vue b/frontend/src/components/Modals/PageModal.vue index f3098db8..0bbee97c 100644 --- a/frontend/src/components/Modals/PageModal.vue +++ b/frontend/src/components/Modals/PageModal.vue @@ -3,22 +3,75 @@ v-model="show" class="text-base" :options="{ - title: __('Apply for this job'), + title: __('Add web page to sidebar'), size: 'lg', actions: [ { - label: 'Submit', + label: 'Add', variant: 'solid', onClick: (close) => { - submitResume(close) + addWebPage(close) }, }, ], }" > - + diff --git a/lms/lms/api.py b/lms/lms/api.py index 9b0e4cc6..aee4e62f 100644 --- a/lms/lms/api.py +++ b/lms/lms/api.py @@ -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 diff --git a/lms/lms/doctype/lms_settings/lms_settings.json b/lms/lms/doctype/lms_settings/lms_settings.json index 4801fd17..1f954b66 100644 --- a/lms/lms/doctype/lms_settings/lms_settings.json +++ b/lms/lms/doctype/lms_settings/lms_settings.json @@ -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", diff --git a/lms/lms/doctype/lms_sidebar_item/lms_sidebar_item.json b/lms/lms/doctype/lms_sidebar_item/lms_sidebar_item.json index e2df0640..c8ec3619 100644 --- a/lms/lms/doctype/lms_sidebar_item/lms_sidebar_item.json +++ b/lms/lms/doctype/lms_sidebar_item/lms_sidebar_item.json @@ -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": [] diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 46b57492..694d80a8 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -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