From 85c2feec0d4d5e616d64b84bda1bab0f158be73c Mon Sep 17 00:00:00 2001 From: scmmishra Date: Wed, 14 Nov 2018 14:23:06 +0530 Subject: [PATCH] Added ListPage and other UI improvements --- erpnext/public/build.json | 2 +- .../js/education/lms/components/Article.vue | 23 ++++----- .../js/education/lms/components/CardList.vue | 4 +- .../education/lms/components/ProgramCard.vue | 2 +- .../js/education/lms/components/Video.vue | 15 +++--- .../js/education/lms/pages/CoursePage.vue | 6 +-- .../public/js/education/lms/pages/Home.vue | 7 ++- .../js/education/lms/pages/ListPage.vue | 51 +++++++++++++++++++ .../js/education/lms/pages/ProgramPage.vue | 6 +-- erpnext/public/js/education/lms/routes.js | 11 ++++ erpnext/www/lms.html | 4 +- erpnext/www/lms.py | 9 ++++ 12 files changed, 102 insertions(+), 38 deletions(-) create mode 100644 erpnext/public/js/education/lms/pages/ListPage.vue diff --git a/erpnext/public/build.json b/erpnext/public/build.json index c9b107c5dd..1abb2fe456 100644 --- a/erpnext/public/build.json +++ b/erpnext/public/build.json @@ -55,7 +55,7 @@ "stock/dashboard/item_dashboard_list.html", "stock/dashboard/item_dashboard.js" ], - "js/academy.min.js": [ + "js/lms.min.js": [ "public/js/education/lms/lms.js" ] } diff --git a/erpnext/public/js/education/lms/components/Article.vue b/erpnext/public/js/education/lms/components/Article.vue index 7fc1173bc9..397b22e6db 100644 --- a/erpnext/public/js/education/lms/components/Article.vue +++ b/erpnext/public/js/education/lms/components/Article.vue @@ -1,8 +1,8 @@ diff --git a/erpnext/public/js/education/lms/components/CardList.vue b/erpnext/public/js/education/lms/components/CardList.vue index 0c03cf6265..8f6f7c79ae 100644 --- a/erpnext/public/js/education/lms/components/CardList.vue +++ b/erpnext/public/js/education/lms/components/CardList.vue @@ -3,9 +3,9 @@

- +
- View All +
diff --git a/erpnext/public/js/education/lms/components/ProgramCard.vue b/erpnext/public/js/education/lms/components/ProgramCard.vue index 23e7a96381..6bd8532b52 100644 --- a/erpnext/public/js/education/lms/components/ProgramCard.vue +++ b/erpnext/public/js/education/lms/components/ProgramCard.vue @@ -57,7 +57,7 @@ export default { } }, programPageRoute() { - return `Program/${this.program.name}` + return { name: 'program', params: { program_name: this.program.name }} }, isEnrolled() { return lms.store.enrolledPrograms.has(this.program.name) diff --git a/erpnext/public/js/education/lms/components/Video.vue b/erpnext/public/js/education/lms/components/Video.vue index 26d3bf698c..c13d0dbfd2 100644 --- a/erpnext/public/js/education/lms/components/Video.vue +++ b/erpnext/public/js/education/lms/components/Video.vue @@ -46,15 +46,12 @@ export default { } }, mounted() { - frappe.call({ - method: "erpnext.www.lms.get_content", - args: { - content_name: this.content, - content_type: this.type - } - }).then(r => { - this.contentData = r.message - }); + this.getContent().then(data => this.contentData = data); }, + methods: { + getContent() { + return frappe.db.get_doc(this.type, this.content) + } + } }; diff --git a/erpnext/public/js/education/lms/pages/CoursePage.vue b/erpnext/public/js/education/lms/pages/CoursePage.vue index 477de4696b..f83857532a 100644 --- a/erpnext/public/js/education/lms/pages/CoursePage.vue +++ b/erpnext/public/js/education/lms/pages/CoursePage.vue @@ -1,7 +1,7 @@ @@ -9,7 +9,7 @@ import Article from "../components/Article.vue" import Quiz from "../components/Quiz.vue" import Video from "../components/Video.vue" -import Navigation from "../components/Navigation.vue" +import ContentNavigation from "../components/ContentNavigation.vue" export default { props:['program_name', 'course', 'type', 'content'], @@ -50,7 +50,7 @@ export default { Article, Video, Quiz, - Navigation + ContentNavigation } }; diff --git a/erpnext/public/js/education/lms/pages/Home.vue b/erpnext/public/js/education/lms/pages/Home.vue index f823d380e8..b3120845ce 100644 --- a/erpnext/public/js/education/lms/pages/Home.vue +++ b/erpnext/public/js/education/lms/pages/Home.vue @@ -4,11 +4,13 @@ - + + View All \ No newline at end of file diff --git a/erpnext/public/js/education/lms/pages/ProgramPage.vue b/erpnext/public/js/education/lms/pages/ProgramPage.vue index c0d4f15572..bc0f2670c1 100644 --- a/erpnext/public/js/education/lms/pages/ProgramPage.vue +++ b/erpnext/public/js/education/lms/pages/ProgramPage.vue @@ -1,16 +1,13 @@ + {% endblock %} \ No newline at end of file diff --git a/erpnext/www/lms.py b/erpnext/www/lms.py index ab01aed9d9..bb5daaf02a 100644 --- a/erpnext/www/lms.py +++ b/erpnext/www/lms.py @@ -28,6 +28,15 @@ def get_featured_programs(): else: return None +@frappe.whitelist(allow_guest=True) +def get_all_programs(): + program_names = frappe.get_all("Program", filters={"is_published": True}) + if program_names: + featured_list = [get_program(program['name']) for program in program_names] + return featured_list + else: + return None + def get_program(program_name): program = frappe.get_doc('Program', program_name) is_enrolled = check_program_enrollment(program_name)