Merge branch 'feature/student-submissions'
This commit is contained in:
commit
9fad28f97c
|
|
@ -0,0 +1,39 @@
|
||||||
|
<template>
|
||||||
|
<div class="assignment-with-submissions">
|
||||||
|
<h1 class="assignment-with-submissions__title">{{assignment.title}}</h1>
|
||||||
|
|
||||||
|
<student-submission class="assignment-with-submissions__submission"
|
||||||
|
v-for="(submission, index) in assignment.submissions"
|
||||||
|
:key="index"
|
||||||
|
:submission="submission"
|
||||||
|
>
|
||||||
|
</student-submission>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import StudentSubmission from '@/components/StudentSubmission';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: ['assignment'],
|
||||||
|
|
||||||
|
components: {
|
||||||
|
StudentSubmission
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "@/styles/_variables.scss";
|
||||||
|
@import "@/styles/_functions.scss";
|
||||||
|
|
||||||
|
.assignment-with-submissions {
|
||||||
|
&__title {
|
||||||
|
font-size: toRem(35px);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__submission:first-of-type {
|
||||||
|
border-top: 1px solid $color-grey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="student-submission">
|
<div class="student-submission">
|
||||||
<div class="student-submission__student-name">
|
<div class="student-submission__student-name">
|
||||||
{{submission.name}}
|
{{name}}
|
||||||
</div>
|
</div>
|
||||||
<div class="student-submission__entry">
|
<div class="student-submission__entry">
|
||||||
{{submission.text}}
|
{{submission.text}}
|
||||||
|
|
@ -11,7 +11,14 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: ['submission']
|
props: ['submission'],
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
name() {
|
||||||
|
return this.submission && this.submission.student
|
||||||
|
? `${this.submission.student.firstName} ${this.submission.student.lastName}` : '';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,39 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<nav class="module-navigation">
|
<nav class="module-navigation">
|
||||||
<h3 class="module-navigation__heading">Inhalte: {{module.metaTitle}}</h3>
|
<div class="module-navigation__module-content">
|
||||||
<div class="module-navigation__anchors">
|
|
||||||
<a href="#" class="module-navigation__anchor module-navigation__anchor--active">Einleitung</a>
|
|
||||||
<a href="#" v-scroll-to="'#objectives'" class="module-navigation__anchor">Lernziele</a>
|
|
||||||
|
|
||||||
<a href="#" class="module-navigation__anchor"
|
|
||||||
v-scroll-to="chapterId(index)"
|
|
||||||
v-for="(chapter, index) in module.chapters"
|
|
||||||
:key="chapter.id">{{chapter.title}}</a>
|
|
||||||
<a href="#" class="module-navigation__anchor">Lernzielkontrolle</a>
|
|
||||||
</div>
|
|
||||||
<router-link tag="h3" to="/module/submissions" class="module-navigation__heading">Ergebnisse: {{module.metaTitle}}
|
|
||||||
</router-link>
|
|
||||||
<div class="module-navigation__anchors">
|
|
||||||
<router-link
|
<router-link
|
||||||
to="/module/geld/submissions"
|
tag="h3"
|
||||||
v-for="assignment in module.assignments"
|
:to="moduleContentLink"
|
||||||
:key="assignment.id"
|
class="module-navigation__heading"
|
||||||
class="module-navigation__anchor"
|
>Inhalte: {{module.metaTitle}}
|
||||||
>{{assignment.title}}
|
|
||||||
</router-link>
|
</router-link>
|
||||||
|
<div class="module-navigation__anchors" v-if="onModulePage">
|
||||||
|
<a href="#" class="module-navigation__anchor module-navigation__anchor--active">Einleitung</a>
|
||||||
|
<a href="#" v-scroll-to="'#objectives'" class="module-navigation__anchor">Lernziele</a>
|
||||||
|
|
||||||
|
<a href="#" class="module-navigation__anchor"
|
||||||
|
v-scroll-to="chapterId(index)"
|
||||||
|
v-for="(chapter, index) in module.chapters"
|
||||||
|
:key="chapter.id">{{chapter.title}}</a>
|
||||||
|
<a href="#" class="module-navigation__anchor">Lernzielkontrolle</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="module-navigation__module-submissions">
|
||||||
|
<router-link tag="h3" to="/module/submissions" class="module-navigation__heading">Ergebnisse:
|
||||||
|
{{module.metaTitle}}
|
||||||
|
</router-link>
|
||||||
|
<div class="module-navigation__anchors">
|
||||||
|
<router-link
|
||||||
|
:to="submissionsLink(assignment)"
|
||||||
|
v-for="assignment in module.assignments"
|
||||||
|
:key="assignment.id"
|
||||||
|
class="module-navigation__anchor"
|
||||||
|
exact-active-class="module-navigation__anchor--active"
|
||||||
|
>{{assignment.title}}
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -37,6 +49,15 @@
|
||||||
module: moduleQuery
|
module: moduleQuery
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
onModulePage() {
|
||||||
|
return this.$route.name === 'module';
|
||||||
|
},
|
||||||
|
moduleContentLink() {
|
||||||
|
return `/module/${this.module.slug}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
module: {}
|
module: {}
|
||||||
|
|
@ -46,6 +67,9 @@
|
||||||
methods: {
|
methods: {
|
||||||
chapterId(index) {
|
chapterId(index) {
|
||||||
return `#chapter-${index}`
|
return `#chapter-${index}`
|
||||||
|
},
|
||||||
|
submissionsLink(assignment) {
|
||||||
|
return `/module/${this.module.slug}/submissions/${assignment.id}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -65,15 +89,20 @@
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 32px;
|
top: 32px;
|
||||||
|
|
||||||
|
&__module-content {
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
&__heading {
|
&__heading {
|
||||||
@include module-navigation-typography;
|
@include module-navigation-typography;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 1.0625rem;
|
font-size: 1.0625rem;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
&__anchors {
|
&__anchors {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 16px 24px;
|
padding: 16px 24px 0;
|
||||||
}
|
}
|
||||||
&__anchor {
|
&__anchor {
|
||||||
@include module-navigation-typography;
|
@include module-navigation-typography;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
query AssignmentWithSubmissions($id: ID!) {
|
||||||
|
assignment(id: $id) {
|
||||||
|
title
|
||||||
|
submissions {
|
||||||
|
id
|
||||||
|
text
|
||||||
|
document
|
||||||
|
student {
|
||||||
|
firstName
|
||||||
|
lastName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,61 +1,49 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="submissions-page">
|
<div class="submissions-page">
|
||||||
<h1 class="submissions-page__title">Auftrag 2 - Aufgabe Interview</h1>
|
<assignment-with-submissions v-if="!$apollo.queries.assignment.loading"
|
||||||
|
:assignment="assignment"></assignment-with-submissions>
|
||||||
<student-submission class="submissions-page__submission"
|
|
||||||
v-for="(submission, index) in submissions"
|
|
||||||
:key="index"
|
|
||||||
:submission="submission"
|
|
||||||
>
|
|
||||||
</student-submission>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import StudentSubmission from '@/components/StudentSubmission';
|
import AssignmentWithSubmissions from '@/components/AssignmentWithSubmissions';
|
||||||
|
|
||||||
|
import ASSIGNMENT_WITH_SUBMISSIONS_QUERY from '@/graphql/gql/assignmentWithSubmissionsQuery.gql';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
StudentSubmission
|
AssignmentWithSubmissions
|
||||||
|
},
|
||||||
|
|
||||||
|
apollo: {
|
||||||
|
assignment() {
|
||||||
|
return {
|
||||||
|
query: ASSIGNMENT_WITH_SUBMISSIONS_QUERY,
|
||||||
|
variables() {
|
||||||
|
return {
|
||||||
|
id: this.$route.params.id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
update(result) {
|
||||||
|
return result.assignment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
submissions: [
|
assignment: {
|
||||||
{name: 'Hans Muster', text: 'Äusserlich erkennbare Schäden bitten wir sofort bei Lieferung…'},
|
submissions: []
|
||||||
{name: 'Max Steiner', text: 'Als Kommentar wird eine meinungsbildende und… '},
|
}
|
||||||
{name: 'Corinne Stalder', text: 'interview-LG.pdf'},
|
|
||||||
{name: 'Hans Muster', text: 'Äusserlich erkennbare Schäden bitten wir sofort bei Lieferung…'},
|
|
||||||
{name: 'Max Steiner', text: 'Als Kommentar wird eine meinungsbildende und… '},
|
|
||||||
{name: 'Corinne Stalder', text: 'interview-LG.pdf'},
|
|
||||||
{name: 'Hans Muster', text: 'Äusserlich erkennbare Schäden bitten wir sofort bei Lieferung…'},
|
|
||||||
{name: 'Max Steiner', text: 'Als Kommentar wird eine meinungsbildende und… '},
|
|
||||||
{name: 'Corinne Stalder', text: 'interview-LG.pdf'},
|
|
||||||
{name: 'Hans Muster', text: 'Äusserlich erkennbare Schäden bitten wir sofort bei Lieferung…'},
|
|
||||||
{name: 'Max Steiner', text: 'Als Kommentar wird eine meinungsbildende und… '},
|
|
||||||
{name: 'Corinne Stalder', text: 'interview-LG.pdf'}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "@/styles/_variables.scss";
|
|
||||||
@import "@/styles/_functions.scss";
|
|
||||||
|
|
||||||
.submissions-page {
|
.submissions-page {
|
||||||
/*grid-column: span 2;*/
|
|
||||||
width: 800px;
|
width: 800px;
|
||||||
/*padding-left: 150px;*/
|
|
||||||
|
|
||||||
&__title {
|
|
||||||
font-size: toRem(35px);
|
|
||||||
}
|
|
||||||
|
|
||||||
&__submission:first-of-type {
|
|
||||||
border-top: 1px solid $color-grey;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ const routes = [
|
||||||
meta: {filter: true}
|
meta: {filter: true}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'submissions',
|
path: 'submissions/:id',
|
||||||
name: 'submissions',
|
name: 'submissions',
|
||||||
component: submissions,
|
component: submissions,
|
||||||
meta: {filter: true}
|
meta: {filter: true}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from graphene import relay
|
from graphene import relay
|
||||||
import graphene
|
|
||||||
from graphene_django.filter import DjangoFilterConnectionField
|
from graphene_django.filter import DjangoFilterConnectionField
|
||||||
|
|
||||||
from assignments.schema.types import AssignmentNode
|
from assignments.schema.types import AssignmentNode
|
||||||
|
|
@ -7,4 +6,4 @@ from assignments.schema.types import AssignmentNode
|
||||||
|
|
||||||
class AssignmentsQuery(object):
|
class AssignmentsQuery(object):
|
||||||
assignment = relay.Node.Field(AssignmentNode)
|
assignment = relay.Node.Field(AssignmentNode)
|
||||||
assignments = DjangoFilterConnectionField(AssignmentNode)
|
assignments = DjangoFilterConnectionField(AssignmentNode)
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,6 @@ class AssignmentNode(DjangoObjectType):
|
||||||
def resolve_submission(self, info, **kwargs):
|
def resolve_submission(self, info, **kwargs):
|
||||||
return self.submissions.filter(student=info.context.user).first() # returns None if it doesn't exist yet
|
return self.submissions.filter(student=info.context.user).first() # returns None if it doesn't exist yet
|
||||||
|
|
||||||
|
#todo: restrict for students
|
||||||
def resolve_submissions(self, info, **kwargs):
|
def resolve_submissions(self, info, **kwargs):
|
||||||
return self.submissions.all()
|
return self.submissions.all()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue