Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions frontend/src/components/AssessmentPlugin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,51 @@
v-model="quiz"
doctype="LMS Quiz"
:label="__('Select a quiz')"
placeholder=" "
:onCreate="(value, close) => redirectToForm()"
/>
<Link
v-else
v-model="assignment"
doctype="LMS Assignment"
:label="__('Select an assignment')"
:onCreate="(value, close) => redirectToForm()"
/>
<div v-else class="space-y-4">
<Link
v-if="filterAssignmentsByCourse"
v-model="assignment"
doctype="LMS Assignment"
:filters="{
course: route.params.courseName,
}"
placeholder=" "
:label="__('Select an Assignment')"
:onCreate="(value, close) => redirectToForm()"
/>
<Link
v-else
v-model="assignment"
doctype="LMS Assignment"
placeholder=" "
:label="__('Select an Assignment')"
:onCreate="(value, close) => redirectToForm()"
/>
<FormControl
type="checkbox"
:label="__('Filter assignments by course')"
v-model="filterAssignmentsByCourse"
/>
</div>
</div>
</div>
</template>
</Dialog>
</template>
<script setup>
import { Dialog } from 'frappe-ui'
import { onMounted, ref, nextTick } from 'vue'
import Link from '@/components/Controls/Link.vue'
import { Dialog, FormControl } from 'frappe-ui'
import { nextTick, onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { Link } from 'frappe-ui/frappe'

const show = ref(false)
const quiz = ref(null)
const assignment = ref(null)
const filterAssignmentsByCourse = ref(false)
const route = useRoute()

const props = defineProps({
type: {
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/components/Modals/AssignmentForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
:label="__('Submission Type')"
:required="true"
/>
<Link
v-model="assignment.course"
:label="__('Course')"
doctype="LMS Course"
placeholder=" "
/>
<div>
<div class="text-xs text-ink-gray-5 mb-2">
{{ __('Question') }}
Expand Down Expand Up @@ -67,6 +73,7 @@
import { Button, Dialog, FormControl, TextEditor, toast } from 'frappe-ui'
import { computed, reactive, watch } from 'vue'
import { escapeHTML, sanitizeHTML } from '@/utils'
import { Link } from 'frappe-ui/frappe'

const show = defineModel()
const assignments = defineModel<Assignments>('assignments')
Expand All @@ -75,6 +82,7 @@ interface Assignment {
title: string
type: string
question: string
course?: string
}

interface Assignments {
Expand All @@ -89,6 +97,7 @@ const assignment = reactive({
title: '',
type: '',
question: '',
course: '',
})

const props = defineProps({
Expand All @@ -107,6 +116,7 @@ watch(
assignment.title = row.title
assignment.type = row.type
assignment.question = row.question
assignment.course = row.course || ''
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Assignments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const assignmentFilter = computed(() => {

const assignments = createListResource({
doctype: 'LMS Assignment',
fields: ['name', 'title', 'type', 'creation', 'question'],
fields: ['name', 'title', 'type', 'creation', 'question', 'course'],
orderBy: 'modified desc',
cache: ['assignments'],
transform(data) {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/utils/assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AssessmentPlugin from '@/components/AssessmentPlugin.vue'
import translationPlugin from '../translation'
import { usersStore } from '@/stores/user'
import { call } from 'frappe-ui'
import router from '@/router'

export class Assignment {
constructor({ data, api, readOnly }) {
Expand Down Expand Up @@ -84,6 +85,7 @@ export class Assignment {
},
})
app.use(translationPlugin)
app.use(router)
app.mount(this.wrapper)
}

Expand Down
13 changes: 10 additions & 3 deletions lms/lms/doctype/lms_assignment/lms_assignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
"engine": "InnoDB",
"field_order": [
"title",
"question",
"column_break_hmwv",
"type",
"grade_assignment",
"course",
"column_break_hmwv",
"question",
"section_break_sjti",
"show_answer",
"answer"
Expand Down Expand Up @@ -68,12 +69,18 @@
{
"fieldname": "section_break_sjti",
"fieldtype": "Section Break"
},
{
"fieldname": "course",
"fieldtype": "Link",
"label": "Course",
"options": "LMS Course"
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-12-17 14:47:05.489937",
"modified": "2025-12-19 16:30:58.531722",
"modified_by": "sayali@frappe.io",
"module": "LMS",
"name": "LMS Assignment",
Expand Down