Skip to content

Commit 7946daa

Browse files
have fun
1 parent 6f17fce commit 7946daa

File tree

4 files changed

+112
-4
lines changed

4 files changed

+112
-4
lines changed

src/views/classroom/ClassroomOverview.vue

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
<template>
22
<div>
3-
ClassroomOverview
3+
<component
4+
:is="component"
5+
:student-pk="studentPk"
6+
@detail="goToDetail($event)"
7+
></component>
48
</div>
59
</template>
610

711
<script lang="ts">
12+
import { User } from '@/interfaces/user'
813
import { Vue, Component } from 'vue-property-decorator'
14+
import ClassroomOverviewStudentList from './ClassroomOverviewStudentList.vue'
15+
import ClassroomOverviewStudentDetail from './ClassroomOverviewStudentDetail.vue'
916
10-
@Component
17+
@Component({
18+
components: {
19+
ClassroomOverviewStudentList,
20+
ClassroomOverviewStudentDetail
21+
}
22+
})
1123
export default class ClassroomOverview extends Vue {
12-
// eslint-disable-next-line no-undef
13-
[key: string]: unknown
24+
component = ClassroomOverviewStudentList
25+
26+
studentPk: User['pk'] | null = null
27+
28+
goToDetail (studentPk: User['pk']): void {
29+
this.studentPk = studentPk
30+
this.component = ClassroomOverviewStudentDetail
31+
}
1432
}
1533
</script>
1634

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div>
3+
{{ studentPk }}
4+
</div>
5+
</template>
6+
7+
<script lang="ts">
8+
import { Classroom } from '@/interfaces/classroom'
9+
import { Vue, Component, Prop } from 'vue-property-decorator'
10+
import { mapState } from 'vuex'
11+
12+
@Component({
13+
computed: {
14+
...mapState('classroom', {
15+
classroom: 'currentClassroom'
16+
})
17+
}
18+
})
19+
export default class ClassroomOverviewStudentDetail extends Vue {
20+
@Prop(Number) readonly studentPk!: number
21+
22+
classroom!: Classroom
23+
24+
get students (): Classroom['students'] {
25+
return this.classroom.students
26+
}
27+
}
28+
</script>
29+
30+
<style scoped lang="scss">
31+
32+
</style>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<template>
2+
<div>
3+
<v-list>
4+
<v-list-item
5+
v-for="student of students"
6+
:key="student.pk"
7+
@click="$emit('detail', student.pk)"
8+
>
9+
<v-list-item-content>
10+
<v-list-item-title>
11+
{{ student.name }}
12+
</v-list-item-title>
13+
<v-list-item-subtitle>
14+
{{ student.email }}
15+
</v-list-item-subtitle>
16+
</v-list-item-content>
17+
</v-list-item>
18+
</v-list>
19+
</div>
20+
</template>
21+
22+
<script lang="ts">
23+
import { Classroom } from '@/interfaces/classroom'
24+
import { Vue, Component } from 'vue-property-decorator'
25+
import { mapState } from 'vuex'
26+
27+
@Component({
28+
computed: {
29+
...mapState('classroom', {
30+
classroom: 'currentClassroom'
31+
})
32+
}
33+
})
34+
export default class ClassroomOverviewStudentList extends Vue {
35+
classroom!: Classroom
36+
37+
get students (): Classroom['students'] {
38+
return this.classroom.students
39+
}
40+
}
41+
</script>
42+
43+
<style scoped lang="scss">
44+
45+
</style>

src/views/classroom/ReadingExerciseSubmitResult.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@
104104
</v-simple-table>
105105
</v-card-text>
106106
</v-card>
107+
108+
<v-btn
109+
color="primary"
110+
link
111+
:to="{
112+
name: 'ClassroomExercisesReading',
113+
params: {
114+
pk: classroom.pk
115+
}
116+
}"
117+
>
118+
Back to classroom
119+
</v-btn>
107120
</v-col>
108121
</v-row>
109122
</div>

0 commit comments

Comments
 (0)