Minor improvements
diff --git a/erpnext/public/js/education/lms/components/CourseCard.vue b/erpnext/public/js/education/lms/components/CourseCard.vue
index 921ad9f..e9b9e07 100644
--- a/erpnext/public/js/education/lms/components/CourseCard.vue
+++ b/erpnext/public/js/education/lms/components/CourseCard.vue
@@ -8,9 +8,10 @@
Course Content
<ul class="mb-0 mt-1">
<li v-for="content in course.course_content" :key="content.name">
- <router-link tag="a" :class="'text-muted'" :to="{name: 'content', params:{program_name: program_name, course: course.name, type:content.content_type, content: content.content} }">
+ <router-link v-if="isLogin" tag="a" :class="'text-muted'" :to="{name: 'content', params:{program_name: program_name, course: course.name, type:content.content_type, content: content.content} }">
<span style="padding-right: 0.4em"><i :class="iconClass(content.content_type)"></i></span>{{ content.content }}
</router-link>
+ <div v-else><span style="padding-right: 0.4em"><i :class="iconClass(content.content_type)"></i></span>{{ content.content }}</div>
</li>
</ul>
</span>
@@ -37,22 +38,17 @@
name: "CourseCard",
data() {
return {
+ isLogin: lms.store.isLogin,
courseMeta: {}
}
},
mounted() {
- this.getCourseMeta().then(data => this.courseMeta = data)
+ if(this.isLogin) this.getCourseMeta().then(data => this.courseMeta = data)
},
components: {
AButton
},
computed: {
- showStart() {
- return lms.loggedIn && !this.courseMeta.flag == "Complete";
- },
- showCompleted() {
- return lms.loggedIn && this.courseMeta.flag == "Complete";
- },
firstContentRoute() {
return `${this.program_name}/${this.course.name}/${this.courseMeta.content_type}/${this.courseMeta.content}`
},
diff --git a/erpnext/public/js/education/lms/routes.js b/erpnext/public/js/education/lms/routes.js
index 9346af7..921f8ec 100644
--- a/erpnext/public/js/education/lms/routes.js
+++ b/erpnext/public/js/education/lms/routes.js
@@ -6,8 +6,21 @@
const routes = [
{name: 'home', path: '', component: Home},
{name: 'program', path: '/Program/:program_name', component: ProgramPage, props: true},
- {name: 'content', path: '/Program/:program_name/:course/:type/:content', component: ContentPage, props: true},
- {name: 'list', path: '/List/:master', component: ListPage, props: true},
+ {
+ name: 'content',
+ path: '/Program/:program_name/:course/:type/:content',
+ component: ContentPage,
+ props: true,
+ beforeEnter: (to, from, next) => {
+ if(!lms.store.isLogin) next({name: 'home'})
+ }
+ },
+ {
+ name: 'list',
+ path: '/List/:master',
+ component: ListPage,
+ props: true
+ },
{
name: 'signup',
path: '/Signup',