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

41 lines
1.1 KiB
Vue
Raw Normal View History

2018-11-01 11:50:04 +00:00
<template>
<div class="nav-buttons">
2018-11-02 10:59:04 +00:00
<button class='btn btn-outline-secondary' @click="$router.go(-1)">Back</button>
2018-11-05 07:41:37 +00:00
<button v-if="nextContent" class='btn btn-primary' @click="goNext()">Next</button>
2019-02-28 11:03:38 +00:00
<button v-else class='btn btn-primary' @click="finish()">Finish Topic</button>
2018-11-01 11:50:04 +00:00
</div>
</template>
<script>
export default {
props: ['nextContent', 'nextContentType'],
2018-11-14 07:35:22 +00:00
name: 'ContentNavigation',
2018-11-03 15:13:59 +00:00
methods: {
2018-11-19 09:42:39 +00:00
addActivity() {
2018-11-05 07:41:37 +00:00
if(this.$route.params.type != "Quiz"){
2018-11-20 13:07:01 +00:00
console.log("Adding Activity")
2018-11-20 12:06:57 +00:00
lms.call("add_activity",
{
course: this.$route.params.course_name,
2018-11-05 07:41:37 +00:00
content_type: this.$route.params.type,
2019-02-28 11:03:38 +00:00
content: this.$route.params.content,
2018-11-05 07:41:37 +00:00
}
2018-11-20 12:06:57 +00:00
)
2018-11-05 07:41:37 +00:00
}
2018-11-19 09:42:39 +00:00
},
goNext() {
this.addActivity()
this.$router.push({ name: 'content', params: { course: this.$route.params.course_name, type:this.nextContentType, content:this.nextContent }})
},
finish() {
2018-11-19 09:42:39 +00:00
this.addActivity()
2019-02-28 11:03:38 +00:00
this.$router.push({ name: 'course', params: { program_name: this.$route.params.program_name, course_name: this.$route.params.course_name}})
2018-11-13 11:17:46 +00:00
lms.trigger('course-completed', course_name);
2018-11-03 15:13:59 +00:00
}
}
2018-11-01 11:50:04 +00:00
};
</script>
<style lang="css" scoped>
</style>