feat: exercise form and submission list
This commit is contained in:
@@ -56,12 +56,18 @@ export class Assignment {
|
||||
})
|
||||
return
|
||||
}
|
||||
this.wrapper.innerHTML = `<div class='border rounded-md p-10 text-center bg-surface-menu-bar mb-2'>
|
||||
<span class="font-medium">
|
||||
Assignment: ${assignment}
|
||||
</span>
|
||||
</div>`
|
||||
return
|
||||
call('frappe.client.get_value', {
|
||||
doctype: 'LMS Assignment',
|
||||
name: assignment,
|
||||
fieldname: ['title'],
|
||||
}).then((data) => {
|
||||
this.wrapper.innerHTML = `<div class='border rounded-md p-4 text-center bg-surface-menu-bar mb-4'>
|
||||
<span class="font-medium">
|
||||
Assignment: ${data.title}
|
||||
</span>
|
||||
</div>`
|
||||
return
|
||||
})
|
||||
}
|
||||
|
||||
renderAssignmentModal() {
|
||||
@@ -79,7 +85,8 @@ export class Assignment {
|
||||
app.mount(this.wrapper)
|
||||
}
|
||||
|
||||
save(blockContent) {
|
||||
save() {
|
||||
if (Object.keys(this.data).length === 0) return {}
|
||||
return {
|
||||
assignment: this.data.assignment,
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { watch } from 'vue'
|
||||
import { call, toast } from 'frappe-ui'
|
||||
import { useTimeAgo } from '@vueuse/core'
|
||||
import { Quiz } from '@/utils/quiz'
|
||||
import { Program } from '@/utils/program'
|
||||
import { Assignment } from '@/utils/assignment'
|
||||
import { Upload } from '@/utils/upload'
|
||||
import { Markdown } from '@/utils/markdownParser'
|
||||
@@ -148,6 +149,7 @@ export function getEditorTools() {
|
||||
},
|
||||
quiz: Quiz,
|
||||
assignment: Assignment,
|
||||
program: Program,
|
||||
upload: Upload,
|
||||
markdown: {
|
||||
class: Markdown,
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { createApp, h } from 'vue'
|
||||
import { Code } from 'lucide-vue-next'
|
||||
import translationPlugin from '@/translation'
|
||||
import ProgrammingExerciseModal from '@/components/Modals/ProgrammingExerciseModal.vue';
|
||||
import ProgrammingExerciseModal from '@/pages/ProgrammingExercises/ProgrammingExerciseModal.vue';
|
||||
import { call } from 'frappe-ui';
|
||||
import { usersStore } from '@/stores/user'
|
||||
|
||||
|
||||
export class Program {
|
||||
|
||||
@@ -59,15 +62,38 @@ export class Program {
|
||||
}
|
||||
|
||||
renderExercise(exercise: string) {
|
||||
this.wrapper.innerHTML = `<div class='border rounded-md p-10 text-center bg-surface-menu-bar mb-2'>
|
||||
<span class="font-medium">
|
||||
Programming Exercise: ${exercise}
|
||||
</span>
|
||||
</div>`
|
||||
return
|
||||
if (this.readOnly) {
|
||||
const { userResource } = usersStore()
|
||||
call('frappe.client.get_value', {
|
||||
doctype: 'LMS Programming Exercise Submission',
|
||||
filters: {
|
||||
exercise: exercise,
|
||||
member: userResource.data?.name,
|
||||
},
|
||||
fieldname: ['name'],
|
||||
}).then((data: { name: string }) => {
|
||||
let submission = data.name || 'new'
|
||||
this.wrapper.innerHTML = `<iframe src="/lms/exercises/${exercise}/submission/${submission}?fromLesson=1" class="w-full h-[900px] border rounded-md"></iframe>`
|
||||
})
|
||||
return
|
||||
}
|
||||
call("frappe.client.get_value", {
|
||||
doctype: 'LMS Programming Exercise',
|
||||
name: exercise,
|
||||
fieldname: "title"
|
||||
}).then((data: { title: string }) => {
|
||||
this.wrapper.innerHTML = `<div class='border rounded-md p-4 text-center bg-surface-menu-bar mb-4'>
|
||||
<span class="font-medium">
|
||||
Programming Exercise: ${data.title}
|
||||
</span>
|
||||
</div>`
|
||||
return
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
save() {
|
||||
if (!this.data.exercise) return {}
|
||||
return {
|
||||
exercise: this.data.exercise,
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export class Quiz {
|
||||
this.wrapper.innerHTML = `<iframe src="/lms/quiz/${quiz}?fromLesson=1" class="w-full h-[500px]"></iframe>`
|
||||
return
|
||||
}
|
||||
this.wrapper.innerHTML = `<div class='border rounded-md p-10 text-center bg-surface-menu-bar mb-2'>
|
||||
this.wrapper.innerHTML = `<div class='border rounded-md p-4 text-center bg-surface-menu-bar mb-4'>
|
||||
<span class="font-medium">
|
||||
Quiz: ${quiz}
|
||||
</span>
|
||||
@@ -68,7 +68,8 @@ export class Quiz {
|
||||
app.mount(this.wrapper)
|
||||
}
|
||||
|
||||
save(blockContent) {
|
||||
save() {
|
||||
if (Object.keys(this.data).length === 0) return {}
|
||||
return {
|
||||
quiz: this.data.quiz,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user