brotherton-erpnext/erpnext/public/js/education/lms/components/CourseCard.vue

71 lines
2.1 KiB
Vue
Raw Normal View History

2018-11-01 11:49:53 +00:00
<template>
<div class="card mt-3" data-list="getting-started">
<div class='card-body'>
<div class="row">
<div class="course-details col-xs-8 col-sm-9 col-md-10">
<h5 class="card-title">{{ course.course_name }}</h5>
<span class="course-list text-muted" id="getting-started">
Course Content
<ul class="mb-0 mt-1">
<li v-for="content in course.course_content" :key="content.name">{{ content.content }}</li>
</ul>
</span>
</div>
2018-11-12 07:20:54 +00:00
<div class='course-buttons text-center col-xs-4 col-sm-3 col-md-2'>
2018-11-09 06:17:09 +00:00
<a-button
2018-11-12 07:20:54 +00:00
:type="buttonType"
size="sm btn-block"
2018-11-09 06:17:09 +00:00
:route="firstContentRoute"
>
2018-11-12 07:20:54 +00:00
{{ courseMeta.flag }}
2018-11-09 06:17:09 +00:00
</a-button>
2018-11-01 11:49:53 +00:00
</div>
</div>
</div>
</div>
</template>
<script>
2018-11-12 07:20:54 +00:00
import AButton from './Button.vue';
2018-11-02 15:21:24 +00:00
2018-11-01 11:49:53 +00:00
export default {
2018-11-12 07:20:54 +00:00
props: ['course', 'courseMeta', 'program_name'],
2018-11-13 11:54:07 +00:00
name: "CourseCard",
2018-11-02 15:21:24 +00:00
components: {
2018-11-09 06:17:09 +00:00
AButton
},
computed: {
showStart() {
2018-11-13 11:17:46 +00:00
return lms.loggedIn && !this.courseMeta.flag == "Completed";
2018-11-09 06:17:09 +00:00
},
showCompleted() {
2018-11-13 11:17:46 +00:00
return lms.loggedIn && this.courseMeta.flag == "Completed";
2018-11-09 06:17:09 +00:00
},
firstContentRoute() {
2018-11-12 07:20:54 +00:00
return `${this.program_name}/${this.course.name}/${this.courseMeta.content_type}/${this.courseMeta.content}`
},
buttonType() {
if (this.courseMeta.flag == "Start" ){
return "primary"
}
else if (this.courseMeta.flag == "Complete" ) {
return "success"
}
2018-11-13 06:52:49 +00:00
else if (this.courseMeta.flag == "Continue" ) {
2018-11-12 07:20:54 +00:00
return "info"
}
2018-11-13 06:52:49 +00:00
else {
return " hidden"
}
2018-11-09 06:17:09 +00:00
}
2018-11-01 11:49:53 +00:00
}
};
</script>
<style scoped>
@media only screen and (max-width: 576px) {
.course-buttons {
margin-top: 1em;
}
}
</style>