From 8adfe247b2323ae8a5923c9fea2baf96c3ffd66a Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 5 Aug 2024 18:14:35 +0530 Subject: [PATCH] fix: lesson auto save --- frontend/src/components/AppSidebar.vue | 31 +++++---- frontend/src/components/CourseOutline.vue | 4 +- frontend/src/components/MobileLayout.vue | 40 ++++++++---- frontend/src/pages/Batches.vue | 4 +- frontend/src/pages/CertifiedParticipants.vue | 3 +- frontend/src/pages/Courses.vue | 26 ++++---- frontend/src/pages/Lesson.vue | 2 +- .../{CreateLesson.vue => LessonForm.vue} | 63 +++++++++++-------- frontend/src/pages/ProfileAbout.vue | 2 +- frontend/src/router.js | 4 +- frontend/src/stores/session.js | 7 +++ frontend/src/utils/index.js | 2 +- lms/hooks.py | 1 + 13 files changed, 113 insertions(+), 76 deletions(-) rename frontend/src/pages/{CreateLesson.vue => LessonForm.vue} (92%) diff --git a/frontend/src/components/AppSidebar.vue b/frontend/src/components/AppSidebar.vue index 49f33da6..1b796b20 100644 --- a/frontend/src/components/AppSidebar.vue +++ b/frontend/src/components/AppSidebar.vue @@ -100,7 +100,7 @@ import { ChevronRight, Plus } from 'lucide-vue-next' import { createResource, Button } from 'frappe-ui' import PageModal from '@/components/Modals/PageModal.vue' -const { user } = sessionStore() +const { user, sidebarSettings } = sessionStore() const { userResource } = usersStore() const socket = inject('$socket') const unreadCount = ref(0) @@ -115,6 +115,20 @@ onMounted(() => { unreadNotifications.reload() }) addNotifications() + sidebarSettings.reload( + {}, + { + onSuccess(data) { + Object.keys(data).forEach((key) => { + if (!parseInt(data[key])) { + sidebarLinks.value = sidebarLinks.value.filter( + (link) => link.label.toLowerCase().split(' ').join('_') !== key + ) + } + }) + }, + } + ) }) const unreadNotifications = createResource({ @@ -153,21 +167,6 @@ const addNotifications = () => { } } -const sidebarSettings = createResource({ - url: 'lms.lms.api.get_sidebar_settings', - cache: 'Sidebar Settings', - auto: true, - onSuccess(data) { - Object.keys(data).forEach((key) => { - if (!parseInt(data[key])) { - sidebarLinks.value = sidebarLinks.value.filter( - (link) => link.label.toLowerCase().split(' ').join('_') !== key - ) - } - }) - }, -}) - const openPageModal = (link) => { showPageModal.value = true pageToEdit.value = link diff --git a/frontend/src/components/CourseOutline.vue b/frontend/src/components/CourseOutline.vue index 2a7ff7c2..e5d3a98b 100644 --- a/frontend/src/components/CourseOutline.vue +++ b/frontend/src/components/CourseOutline.vue @@ -50,7 +50,7 @@
diff --git a/frontend/src/pages/CertifiedParticipants.vue b/frontend/src/pages/CertifiedParticipants.vue index 583a1061..8351eb20 100644 --- a/frontend/src/pages/CertifiedParticipants.vue +++ b/frontend/src/pages/CertifiedParticipants.vue @@ -6,9 +6,10 @@