fix: branding, course, lesson and certificate creation
This commit is contained in:
@@ -187,14 +187,16 @@ import {
|
||||
FormControl,
|
||||
FileUploader,
|
||||
} from 'frappe-ui'
|
||||
import { inject, onMounted, computed, ref, reactive } from 'vue'
|
||||
import { inject, onMounted, computed, ref, reactive, watch } from 'vue'
|
||||
import { convertToTitleCase, showToast, getFileSize } from '../utils'
|
||||
import Link from '@/components/Controls/Link.vue'
|
||||
import { FileText, X } from 'lucide-vue-next'
|
||||
import { useRouter } from 'vue-router'
|
||||
import CourseOutline from '@/components/CourseOutline.vue'
|
||||
|
||||
const user = inject('$user')
|
||||
const newTag = ref('')
|
||||
const router = useRouter()
|
||||
|
||||
const props = defineProps({
|
||||
courseName: {
|
||||
@@ -318,8 +320,12 @@ const submitCourse = () => {
|
||||
)
|
||||
} else {
|
||||
courseCreationResource.submit(course, {
|
||||
onSuccess() {
|
||||
onSuccess(data) {
|
||||
showToast('Success', 'Course created successfully', 'check')
|
||||
router.push({
|
||||
name: 'CreateCourse',
|
||||
params: { courseName: data.name },
|
||||
})
|
||||
},
|
||||
onError(err) {
|
||||
showToast(err)
|
||||
@@ -347,6 +353,15 @@ const validateMandatoryFields = () => {
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.courseName !== 'new',
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
courseResource.reload()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const validateFile = (file) => {
|
||||
let extension = file.name.split('.').pop().toLowerCase()
|
||||
if (!['jpg', 'jpeg', 'png'].includes(extension)) {
|
||||
|
||||
@@ -73,17 +73,19 @@ import {
|
||||
Button,
|
||||
createDocumentResource,
|
||||
} from 'frappe-ui'
|
||||
import { computed, reactive, onMounted, inject, ref } from 'vue'
|
||||
import { computed, reactive, onMounted, inject, ref, watch } from 'vue'
|
||||
import EditorJS from '@editorjs/editorjs'
|
||||
import { createToast } from '../utils'
|
||||
import LessonPlugins from '@/components/LessonPlugins.vue'
|
||||
import { getEditorTools } from '../utils'
|
||||
import { ChevronRight } from 'lucide-vue-next'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const editor = ref(null)
|
||||
const instructorEditor = ref(null)
|
||||
const user = inject('$user')
|
||||
const openInstructorEditor = ref(false)
|
||||
const router = useRouter()
|
||||
|
||||
const props = defineProps({
|
||||
courseName: {
|
||||
@@ -319,6 +321,7 @@ const createNewLesson = () => {
|
||||
{
|
||||
onSuccess() {
|
||||
showToast('Success', 'Lesson created successfully', 'check')
|
||||
lessonDetails.reload()
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -114,7 +114,10 @@
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="lesson.data.instructor_content && allowInstructorContent()"
|
||||
v-if="
|
||||
lesson.data.instructor_content.blocks?.length &&
|
||||
allowInstructorContent()
|
||||
"
|
||||
class="bg-gray-100 p-3 rounded-md mt-6"
|
||||
>
|
||||
<div class="text-gray-600 font-medium">
|
||||
@@ -233,8 +236,7 @@ const lesson = createResource({
|
||||
markProgress(data)
|
||||
|
||||
if (data.content) editor = renderEditor('editor', data.content)
|
||||
|
||||
if (data.instructor_content)
|
||||
if (data.instructor_content?.blocks?.length)
|
||||
instructorEditor = renderEditor(
|
||||
'instructor-content',
|
||||
data.instructor_content
|
||||
@@ -253,7 +255,8 @@ const renderEditor = (holder, content) => {
|
||||
}
|
||||
|
||||
const markProgress = (data) => {
|
||||
if (!data.progress) progress.submit()
|
||||
console.log(user.data)
|
||||
if (user.data && !data.progress) progress.submit()
|
||||
}
|
||||
|
||||
const current_lesson = createResource({
|
||||
|
||||
Reference in New Issue
Block a user