Minor improvements

This commit is contained in:
scmmishra 2018-11-24 20:31:35 +05:30 committed by Aditya Hase
parent 9229f4fc92
commit 788ffbd5b6
2 changed files with 19 additions and 10 deletions

View File

@ -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 @@ export default {
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}`
},

View File

@ -6,8 +6,21 @@ import ListPage from "./pages/ListPage.vue";
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',