From 1fbe2d4b2b1d5cb4344249602d0112e56e68d052 Mon Sep 17 00:00:00 2001 From: scmmishra Date: Tue, 13 Nov 2018 16:47:46 +0530 Subject: [PATCH] Renamed academy to lms (Client Side) --- erpnext/public/build.json | 2 +- .../{academy => lms}/AcademyRoot.vue | 0 .../js/education/{academy => lms}/call.js | 4 +- .../components/AcademyCourseCard.vue | 4 +- .../components/AcademyCourseCardButton.vue | 4 +- .../components/AcademyList.vue | 0 .../components/AcademyProgramCard.vue | 10 ++--- .../components/AcademyTopSection.vue | 0 .../components/AcademyTopSectionButton.vue | 8 ++-- .../{academy => lms}/components/Button.vue | 0 .../components/ContentArticle.vue | 0 .../components/ContentNavigation.vue | 12 +++--- .../components/ContentQuiz.vue | 2 +- .../components/ContentTitle.vue | 0 .../components/ContentVideo.vue | 0 .../components/Quiz/QuizSingleChoice.vue | 0 .../{academy/academy.js => lms/lms.js} | 38 +++++++++---------- .../pages/AcademyCoursePage.vue | 0 .../{academy => lms}/pages/AcademyHome.vue | 6 +-- .../pages/AcademyProgramPage.vue | 10 ++--- .../js/education/{academy => lms}/routes.js | 0 21 files changed, 50 insertions(+), 50 deletions(-) rename erpnext/public/js/education/{academy => lms}/AcademyRoot.vue (100%) rename erpnext/public/js/education/{academy => lms}/call.js (82%) rename erpnext/public/js/education/{academy => lms}/components/AcademyCourseCard.vue (93%) rename erpnext/public/js/education/{academy => lms}/components/AcademyCourseCardButton.vue (84%) rename erpnext/public/js/education/{academy => lms}/components/AcademyList.vue (100%) rename erpnext/public/js/education/{academy => lms}/components/AcademyProgramCard.vue (87%) rename erpnext/public/js/education/{academy => lms}/components/AcademyTopSection.vue (100%) rename erpnext/public/js/education/{academy => lms}/components/AcademyTopSectionButton.vue (86%) rename erpnext/public/js/education/{academy => lms}/components/Button.vue (100%) rename erpnext/public/js/education/{academy => lms}/components/ContentArticle.vue (100%) rename erpnext/public/js/education/{academy => lms}/components/ContentNavigation.vue (77%) rename erpnext/public/js/education/{academy => lms}/components/ContentQuiz.vue (96%) rename erpnext/public/js/education/{academy => lms}/components/ContentTitle.vue (100%) rename erpnext/public/js/education/{academy => lms}/components/ContentVideo.vue (100%) rename erpnext/public/js/education/{academy => lms}/components/Quiz/QuizSingleChoice.vue (100%) rename erpnext/public/js/education/{academy/academy.js => lms/lms.js} (64%) rename erpnext/public/js/education/{academy => lms}/pages/AcademyCoursePage.vue (100%) rename erpnext/public/js/education/{academy => lms}/pages/AcademyHome.vue (89%) rename erpnext/public/js/education/{academy => lms}/pages/AcademyProgramPage.vue (86%) rename erpnext/public/js/education/{academy => lms}/routes.js (100%) diff --git a/erpnext/public/build.json b/erpnext/public/build.json index 66ac5fe4f1..c9b107c5dd 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -56,6 +56,6 @@ "stock/dashboard/item_dashboard.js" ], "js/academy.min.js": [ - "public/js/education/academy/academy.js" + "public/js/education/lms/lms.js" ] } diff --git a/erpnext/public/js/education/academy/AcademyRoot.vue b/erpnext/public/js/education/lms/AcademyRoot.vue similarity index 100% rename from erpnext/public/js/education/academy/AcademyRoot.vue rename to erpnext/public/js/education/lms/AcademyRoot.vue diff --git a/erpnext/public/js/education/academy/call.js b/erpnext/public/js/education/lms/call.js similarity index 82% rename from erpnext/public/js/education/academy/call.js rename to erpnext/public/js/education/lms/call.js index bdcca3ad4d..0e6c186853 100644 --- a/erpnext/public/js/education/academy/call.js +++ b/erpnext/public/js/education/lms/call.js @@ -1,7 +1,7 @@ frappe.ready(() => { - frappe.provide('academy'); + frappe.provide('lms'); - academy.call = (method, args) => { + lms.call = (method, args) => { const method_path = 'erpnext.www.lms.' + method; return new Promise((resolve, reject) => { return frappe.call({ diff --git a/erpnext/public/js/education/academy/components/AcademyCourseCard.vue b/erpnext/public/js/education/lms/components/AcademyCourseCard.vue similarity index 93% rename from erpnext/public/js/education/academy/components/AcademyCourseCard.vue rename to erpnext/public/js/education/lms/components/AcademyCourseCard.vue index e33f0b063e..405e7ba8f0 100644 --- a/erpnext/public/js/education/academy/components/AcademyCourseCard.vue +++ b/erpnext/public/js/education/lms/components/AcademyCourseCard.vue @@ -38,10 +38,10 @@ export default { }, computed: { showStart() { - return academy.loggedIn && !this.courseMeta.flag == "Completed"; + return lms.loggedIn && !this.courseMeta.flag == "Completed"; }, showCompleted() { - return academy.loggedIn && this.courseMeta.flag == "Completed"; + return lms.loggedIn && this.courseMeta.flag == "Completed"; }, firstContentRoute() { return `${this.program_name}/${this.course.name}/${this.courseMeta.content_type}/${this.courseMeta.content}` diff --git a/erpnext/public/js/education/academy/components/AcademyCourseCardButton.vue b/erpnext/public/js/education/lms/components/AcademyCourseCardButton.vue similarity index 84% rename from erpnext/public/js/education/academy/components/AcademyCourseCardButton.vue rename to erpnext/public/js/education/lms/components/AcademyCourseCardButton.vue index 698eca0e86..180acb2b5f 100644 --- a/erpnext/public/js/education/academy/components/AcademyCourseCardButton.vue +++ b/erpnext/public/js/education/lms/components/AcademyCourseCardButton.vue @@ -13,7 +13,7 @@ export default { }, computed: { getButtonName: function() { - if(academy.store.checkCourseCompletion(this.course)){ + if(lms.store.checkCourseCompletion(this.course)){ return 'Completed' } else{ @@ -21,7 +21,7 @@ export default { } }, getClassName: function() { - if(academy.store.checkCourseCompletion(this.course)){ + if(lms.store.checkCourseCompletion(this.course)){ return 'btn-success' } } diff --git a/erpnext/public/js/education/academy/components/AcademyList.vue b/erpnext/public/js/education/lms/components/AcademyList.vue similarity index 100% rename from erpnext/public/js/education/academy/components/AcademyList.vue rename to erpnext/public/js/education/lms/components/AcademyList.vue diff --git a/erpnext/public/js/education/academy/components/AcademyProgramCard.vue b/erpnext/public/js/education/lms/components/AcademyProgramCard.vue similarity index 87% rename from erpnext/public/js/education/academy/components/AcademyProgramCard.vue rename to erpnext/public/js/education/lms/components/AcademyProgramCard.vue index bea2acf825..c8a7278219 100644 --- a/erpnext/public/js/education/academy/components/AcademyProgramCard.vue +++ b/erpnext/public/js/education/lms/components/AcademyProgramCard.vue @@ -31,18 +31,18 @@ export default { name: "AcademyProgramCard", data() { return { - isLogin: academy.store.isLogin + isLogin: lms.store.isLogin }; }, created() { }, methods: { enroll() { - academy.call('enroll_in_program', { + lms.call('enroll_in_program', { program_name: this.program.name, }).then( - academy.store.enrolledPrograms.add(this.program.name), - academy.store.updateEnrolledPrograms(), + lms.store.enrolledPrograms.add(this.program.name), + lms.store.updateEnrolledPrograms(), this.router.push('Program/' + this.program.name) ) } @@ -60,7 +60,7 @@ export default { return `Program/${this.program.name}` }, isEnrolled() { - return academy.store.enrolledPrograms.has(this.program.name) + return lms.store.enrolledPrograms.has(this.program.name) } }, components: { diff --git a/erpnext/public/js/education/academy/components/AcademyTopSection.vue b/erpnext/public/js/education/lms/components/AcademyTopSection.vue similarity index 100% rename from erpnext/public/js/education/academy/components/AcademyTopSection.vue rename to erpnext/public/js/education/lms/components/AcademyTopSection.vue diff --git a/erpnext/public/js/education/academy/components/AcademyTopSectionButton.vue b/erpnext/public/js/education/lms/components/AcademyTopSectionButton.vue similarity index 86% rename from erpnext/public/js/education/academy/components/AcademyTopSectionButton.vue rename to erpnext/public/js/education/lms/components/AcademyTopSectionButton.vue index 8adb5ecc36..822b834d47 100644 --- a/erpnext/public/js/education/academy/components/AcademyTopSectionButton.vue +++ b/erpnext/public/js/education/lms/components/AcademyTopSectionButton.vue @@ -8,7 +8,7 @@ export default { data() { return { buttonName: '', - isLoggedIn: academy.store.checkLogin(), + isLoggedIn: lms.store.checkLogin(), nextContent: '', nextContentType: '', nextCourse: '', @@ -30,7 +30,7 @@ export default { } if(this.isLoggedIn){ - if(academy.store.checkProgramEnrollment(this.$route.params.program_name)){ + if(lms.store.checkProgramEnrollment(this.$route.params.program_name)){ if(this.$route.name == 'home'){ this.buttonName = 'Explore Courses' } @@ -51,7 +51,7 @@ export default { if(this.$route.name == 'home'){ return } - else if(this.$route.name == 'program' && academy.store.checkProgramEnrollment(this.$route.params.program_name)){ + else if(this.$route.name == 'program' && lms.store.checkProgramEnrollment(this.$route.params.program_name)){ this.$router.push({ name: 'content', params: { program_name: this.$route.params.program_name, course: this.nextCourse, type: this.nextContentType, content: this.nextContent}}) } else { @@ -62,7 +62,7 @@ export default { student_email_id: frappe.session.user } }) - academy.store.updateEnrolledPrograms() + lms.store.updateEnrolledPrograms() } }, } diff --git a/erpnext/public/js/education/academy/components/Button.vue b/erpnext/public/js/education/lms/components/Button.vue similarity index 100% rename from erpnext/public/js/education/academy/components/Button.vue rename to erpnext/public/js/education/lms/components/Button.vue diff --git a/erpnext/public/js/education/academy/components/ContentArticle.vue b/erpnext/public/js/education/lms/components/ContentArticle.vue similarity index 100% rename from erpnext/public/js/education/academy/components/ContentArticle.vue rename to erpnext/public/js/education/lms/components/ContentArticle.vue diff --git a/erpnext/public/js/education/academy/components/ContentNavigation.vue b/erpnext/public/js/education/lms/components/ContentNavigation.vue similarity index 77% rename from erpnext/public/js/education/academy/components/ContentNavigation.vue rename to erpnext/public/js/education/lms/components/ContentNavigation.vue index 421606dfae..7495717ec1 100644 --- a/erpnext/public/js/education/academy/components/ContentNavigation.vue +++ b/erpnext/public/js/education/lms/components/ContentNavigation.vue @@ -16,7 +16,7 @@ export default { frappe.call({ method: "erpnext.www.lms.add_activity", args: { - enrollment: academy.store.enrolledCourses[this.$route.params.course], + enrollment: lms.store.enrolledCourses[this.$route.params.course], content_type: this.$route.params.type, content: this.$route.params.content } @@ -29,7 +29,7 @@ export default { frappe.call({ method: "erpnext.www.lms.add_activity", args: { - enrollment: academy.store.enrolledCourses[this.$route.params.course], + enrollment: lms.store.enrolledCourses[this.$route.params.course], content_type: this.$route.params.type, content: this.$route.params.content } @@ -38,15 +38,15 @@ export default { frappe.call({ method: "erpnext.www.lms.mark_course_complete", args: { - enrollment: academy.store.enrolledCourses[this.$route.params.course] + enrollment: lms.store.enrolledCourses[this.$route.params.course] } }) - // academy.store.addCompletedCourses(this.$route.params.course) - academy.store.updateCompletedCourses() + // lms.store.addCompletedCourses(this.$route.params.course) + lms.store.updateCompletedCourses() this.$router.push({ name: 'program', params: { program_name: this.$route.params.program_name}}) // - academy.trigger('course-completed', course_name); + lms.trigger('course-completed', course_name); } } }; diff --git a/erpnext/public/js/education/academy/components/ContentQuiz.vue b/erpnext/public/js/education/lms/components/ContentQuiz.vue similarity index 96% rename from erpnext/public/js/education/academy/components/ContentQuiz.vue rename to erpnext/public/js/education/lms/components/ContentQuiz.vue index 149d314b9d..dd32bf40d0 100644 --- a/erpnext/public/js/education/academy/components/ContentQuiz.vue +++ b/erpnext/public/js/education/lms/components/ContentQuiz.vue @@ -72,7 +72,7 @@ export default { frappe.call({ method: "erpnext.www.lms.evaluate_quiz", args: { - enrollment: academy.store.enrolledCourses[this.$route.params.course], + enrollment: lms.store.enrolledCourses[this.$route.params.course], quiz_response: this.quizResponse, quiz_name: this.content } diff --git a/erpnext/public/js/education/academy/components/ContentTitle.vue b/erpnext/public/js/education/lms/components/ContentTitle.vue similarity index 100% rename from erpnext/public/js/education/academy/components/ContentTitle.vue rename to erpnext/public/js/education/lms/components/ContentTitle.vue diff --git a/erpnext/public/js/education/academy/components/ContentVideo.vue b/erpnext/public/js/education/lms/components/ContentVideo.vue similarity index 100% rename from erpnext/public/js/education/academy/components/ContentVideo.vue rename to erpnext/public/js/education/lms/components/ContentVideo.vue diff --git a/erpnext/public/js/education/academy/components/Quiz/QuizSingleChoice.vue b/erpnext/public/js/education/lms/components/Quiz/QuizSingleChoice.vue similarity index 100% rename from erpnext/public/js/education/academy/components/Quiz/QuizSingleChoice.vue rename to erpnext/public/js/education/lms/components/Quiz/QuizSingleChoice.vue diff --git a/erpnext/public/js/education/academy/academy.js b/erpnext/public/js/education/lms/lms.js similarity index 64% rename from erpnext/public/js/education/academy/academy.js rename to erpnext/public/js/education/lms/lms.js index e8e96f1c12..13938e3a41 100644 --- a/erpnext/public/js/education/academy/academy.js +++ b/erpnext/public/js/education/lms/lms.js @@ -15,14 +15,14 @@ var store = { } frappe.ready(() => { - frappe.provide('academy') - // frappe.utils.make_event_emitter(academy); + frappe.provide('lms') + // frappe.utils.make_event_emitter(lms); - academy.store = new Vue({ + lms.store = new Vue({ data: store, methods: { addCompletedCourses (courseName){ - if (academy.debug) console.log('addCompletedCourses triggered with', courseName) + if (lms.debug) console.log('addCompletedCourses triggered with', courseName) this.completedCourses.add(courseName) }, @@ -40,32 +40,32 @@ frappe.ready(() => { }, updateEnrolledPrograms (){ - if (academy.debug) console.log('Updating enrolledPrograms') - academy.call("get_program_enrollments").then(data => { + if (lms.debug) console.log('Updating enrolledPrograms') + lms.call("get_program_enrollments").then(data => { data.forEach(element => { this.enrolledPrograms.add(element) }) }); - if (academy.debug) console.log('Updated State', this.enrolledPrograms) + if (lms.debug) console.log('Updated State', this.enrolledPrograms) }, updateEnrolledCourses (){ - if (academy.debug) console.log('Updating enrolledCourses') + if (lms.debug) console.log('Updating enrolledCourses') frappe.call({ - method: "erpnext.www.academy.get_course_enrollments", + method: "erpnext.www.lms.get_course_enrollments", args:{ email: frappe.session.user } }).then( r => { this.enrolledCourses = r.message }) - if (academy.debug) console.log('Updated State', this.enrolledCourses) + if (lms.debug) console.log('Updated State', this.enrolledCourses) }, updateCompletedCourses (){ - if (academy.debug) console.log('Updating States') + if (lms.debug) console.log('Updating States') frappe.call({ - method: "erpnext.www.academy.get_completed_courses", + method: "erpnext.www.lms.get_completed_courses", args:{ email: frappe.session.user } @@ -76,16 +76,16 @@ frappe.ready(() => { } } }) - if (academy.debug) console.log('Updated State', this.completedCourses) + if (lms.debug) console.log('Updated State', this.completedCourses) }, checkLogin (){ if(frappe.session.user === "Guest"){ - if (academy.debug) console.log('No Session') + if (lms.debug) console.log('No Session') this.isLogin = false } else { - if (academy.debug) console.log('Current User: ', frappe.session.user) + if (lms.debug) console.log('Current User: ', frappe.session.user) this.isLogin = true } return this.isLogin @@ -100,17 +100,17 @@ frappe.ready(() => { } }); - academy.view = new Vue({ + lms.view = new Vue({ el: "#lms-app", router: new VueRouter({ routes }), template: "", components: { AcademyRoot }, created: function() { - if(academy.store.checkLogin()){ - academy.store.updateState() + if(lms.store.checkLogin()){ + lms.store.updateState() } } }); - academy.debug = true + lms.debug = true }) \ No newline at end of file diff --git a/erpnext/public/js/education/academy/pages/AcademyCoursePage.vue b/erpnext/public/js/education/lms/pages/AcademyCoursePage.vue similarity index 100% rename from erpnext/public/js/education/academy/pages/AcademyCoursePage.vue rename to erpnext/public/js/education/lms/pages/AcademyCoursePage.vue diff --git a/erpnext/public/js/education/academy/pages/AcademyHome.vue b/erpnext/public/js/education/lms/pages/AcademyHome.vue similarity index 89% rename from erpnext/public/js/education/academy/pages/AcademyHome.vue rename to erpnext/public/js/education/lms/pages/AcademyHome.vue index e59074567e..64a66f159b 100644 --- a/erpnext/public/js/education/academy/pages/AcademyHome.vue +++ b/erpnext/public/js/education/lms/pages/AcademyHome.vue @@ -42,13 +42,13 @@ export default { }, methods: { // updateEnrolledPrograms(){ - // return academy.call("get_program_enrollments") + // return lms.call("get_program_enrollments") // }, getPortalDetails() { - return academy.call("get_portal_details") + return lms.call("get_portal_details") }, getFeaturedPrograms() { - return academy.call("get_featured_programs") + return lms.call("get_featured_programs") } } }; diff --git a/erpnext/public/js/education/academy/pages/AcademyProgramPage.vue b/erpnext/public/js/education/lms/pages/AcademyProgramPage.vue similarity index 86% rename from erpnext/public/js/education/academy/pages/AcademyProgramPage.vue rename to erpnext/public/js/education/lms/pages/AcademyProgramPage.vue index 607524ab73..e9b0085e25 100644 --- a/erpnext/public/js/education/academy/pages/AcademyProgramPage.vue +++ b/erpnext/public/js/education/lms/pages/AcademyProgramPage.vue @@ -32,13 +32,13 @@ export default { } }, beforeMount() { - if(academy.store.isLogin) academy.store.updateCompletedCourses() + if(lms.store.isLogin) lms.store.updateCompletedCourses() }, mounted() { this.getProgramDetails().then(data => this.program = data); this.getCourses().then(data => this.course_data = data); - // academy.on(`course-completed`, (course_name) => { + // lms.on(`course-completed`, (course_name) => { // const course = this.course_data.findIndex(c => c.name === course_name); // this.course_data[course].completed = true; // }); @@ -51,17 +51,17 @@ export default { ) }, getContentForNextCourse() { - return academy.call('get_continue_data', { + return lms.call('get_continue_data', { program_name: this.program_name }); }, getProgramDetails() { - return academy.call('get_program_details', { + return lms.call('get_program_details', { program_name: this.program_name }); }, getCourses() { - return academy.call('get_courses', { + return lms.call('get_courses', { program_name: this.program_name }) } diff --git a/erpnext/public/js/education/academy/routes.js b/erpnext/public/js/education/lms/routes.js similarity index 100% rename from erpnext/public/js/education/academy/routes.js rename to erpnext/public/js/education/lms/routes.js