Renamed academy to lms (Client Side)
This commit is contained in:
parent
35bf561a6f
commit
1fbe2d4b2b
@ -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"
|
||||
]
|
||||
}
|
||||
|
@ -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({
|
@ -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}`
|
@ -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'
|
||||
}
|
||||
}
|
@ -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: {
|
@ -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()
|
||||
}
|
||||
},
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
@ -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
|
||||
}
|
@ -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: "<academy-root/>",
|
||||
components: { AcademyRoot },
|
||||
created: function() {
|
||||
if(academy.store.checkLogin()){
|
||||
academy.store.updateState()
|
||||
if(lms.store.checkLogin()){
|
||||
lms.store.updateState()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
academy.debug = true
|
||||
lms.debug = true
|
||||
})
|
@ -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")
|
||||
}
|
||||
}
|
||||
};
|
@ -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
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user