Add link to document
This commit is contained in:
parent
d7aa98e3e3
commit
8da1d63b42
|
|
@ -3,21 +3,29 @@
|
||||||
<div class="student-submission__student-name">
|
<div class="student-submission__student-name">
|
||||||
{{name}}
|
{{name}}
|
||||||
</div>
|
</div>
|
||||||
<div class="student-submission__entry">
|
<div class="student-submission__entry entry">
|
||||||
{{submission.text | trimToLength(50)}}
|
<p>{{submission.text | trimToLength(50)}}</p>
|
||||||
|
<p v-if="submission.document && submission.document.length > 0" class="entry__document">
|
||||||
|
<student-submission-document :document="submission.document" class="entry-document"></student-submission-document>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import DocumentIcon from '@/components/icons/DocumentIcon'
|
||||||
|
import StudentSubmissionDocument from '@/components/StudentSubmissionDocument';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['submission'],
|
props: ['submission'],
|
||||||
|
components: { DocumentIcon, StudentSubmissionDocument },
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
name() {
|
name() {
|
||||||
return this.submission && this.submission.student
|
return this.submission && this.submission.student
|
||||||
? `${this.submission.student.firstName} ${this.submission.student.lastName}` : '';
|
? `${this.submission.student.firstName} ${this.submission.student.lastName}` : '';
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
trimToLength: function(text, numberOfChars) {
|
trimToLength: function(text, numberOfChars) {
|
||||||
|
|
@ -31,7 +39,7 @@
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
return `${text.substring(0, index)}...`;
|
return `${text.substring(0, index)}…`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -58,5 +66,9 @@
|
||||||
font-size: toRem(14px);
|
font-size: toRem(14px);
|
||||||
font-family: $sans-serif-font-family;
|
font-family: $sans-serif-font-family;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.entry-document {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
<template>
|
||||||
|
<div class="submission-document">
|
||||||
|
<p v-if="document && document.length > 0" class="submission-document__content content">
|
||||||
|
<document-icon class="content__icon"></document-icon><span class="content__text">{{filename}}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import DocumentIcon from '@/components/icons/DocumentIcon'
|
||||||
|
import filenameFromUrl from '@/helpers/urls';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: ['document'],
|
||||||
|
name: 'student-submission-document',
|
||||||
|
components: { DocumentIcon },
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
filename() {
|
||||||
|
return filenameFromUrl(this.document)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
width: 25px;
|
||||||
|
align-self: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
align-self: center;
|
||||||
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
export default function filenameFromUrl(url) {
|
||||||
|
const index = url.lastIndexOf('/');
|
||||||
|
|
||||||
|
if (index === -1) { return url }
|
||||||
|
return url.substring(index + 1);
|
||||||
|
}
|
||||||
|
|
@ -64,46 +64,3 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
@import "@/styles/_variables.scss";
|
|
||||||
@import "@/styles/_functions.scss";
|
|
||||||
|
|
||||||
.article {
|
|
||||||
|
|
||||||
&__header {
|
|
||||||
grid-template-rows: 50px minmax(50px, max-content) auto;
|
|
||||||
grid-row-gap: 30px;
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__meta {
|
|
||||||
border-bottom: 1px solid $color-lightgrey;
|
|
||||||
align-self: end;
|
|
||||||
padding: 20px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__title {
|
|
||||||
grid-row: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__subtitle {
|
|
||||||
grid-row: 2;
|
|
||||||
font-family: $serif-font-family;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__content {
|
|
||||||
display: -ms-grid;
|
|
||||||
display: grid;
|
|
||||||
grid-row-gap: 40px;
|
|
||||||
padding-bottom: 40px;
|
|
||||||
|
|
||||||
/deep/ p {
|
|
||||||
font-size: toRem(18px);
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -4,22 +4,24 @@
|
||||||
<h1 class="article__title">{{studentSubmission.assignment.title}}</h1>
|
<h1 class="article__title">{{studentSubmission.assignment.title}}</h1>
|
||||||
<h2 class="article__subtitle">{{`${studentSubmission.student.firstName} ${studentSubmission.student.lastName}`}}</h2>
|
<h2 class="article__subtitle">{{`${studentSubmission.student.firstName} ${studentSubmission.student.lastName}`}}</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="article__content">
|
<div class="article__content article-content">
|
||||||
|
<p v-if="studentSubmission.document && studentSubmission.document.length > 0" class="article-content__document">
|
||||||
<text-block :value="studentSubmission">
|
<a :href="studentSubmission.document" class="entry-document__link link" target="_blank">
|
||||||
</text-block>
|
<student-submission-document :document="studentSubmission.document"></student-submission-document>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
<p>{{studentSubmission.text}}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import TextBlock from '@/components/content-blocks/TextBlock';
|
import DocumentIcon from '@/components/icons/DocumentIcon';
|
||||||
|
import StudentSubmissionDocument from '@/components/StudentSubmissionDocument';
|
||||||
import STUDENT_SUBMISSIONS_QUERY from '@/graphql/gql/studentSubmissionQuery.gql';
|
import STUDENT_SUBMISSIONS_QUERY from '@/graphql/gql/studentSubmissionQuery.gql';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: { DocumentIcon, StudentSubmissionDocument },
|
||||||
TextBlock
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -31,7 +33,8 @@
|
||||||
firstName: '',
|
firstName: '',
|
||||||
lastName: ''
|
lastName: ''
|
||||||
},
|
},
|
||||||
text: ''
|
text: '',
|
||||||
|
document: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -51,7 +54,50 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.submissions-page {
|
@import "@/styles/_variables.scss";
|
||||||
width: 800px;
|
@import "@/styles/_functions.scss";
|
||||||
|
|
||||||
|
.article {
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
grid-template-rows: 50px minmax(50px, max-content) auto;
|
||||||
|
grid-row-gap: 30px;
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
border-bottom: 1px solid $color-lightgrey;
|
||||||
|
align-self: end;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
grid-row: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
grid-row: 2;
|
||||||
|
font-family: $serif-font-family;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__content {
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
grid-row-gap: 40px;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
|
||||||
|
/deep/ p {
|
||||||
|
font-size: toRem(18px);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-content {
|
||||||
|
&__document {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ const routes = [
|
||||||
{path: '/room/:slug', name: 'room', component: room, props: true},
|
{path: '/room/:slug', name: 'room', component: room, props: true},
|
||||||
{path: '/article/:slug', name: 'article', component: article, meta: {layout: 'simple'}},
|
{path: '/article/:slug', name: 'article', component: article, meta: {layout: 'simple'}},
|
||||||
{path: '/basic-knowledge', name: 'basic-knowledge', component: basicknowledge, meta: {layout: 'simple'}},
|
{path: '/basic-knowledge', name: 'basic-knowledge', component: basicknowledge, meta: {layout: 'simple'}},
|
||||||
{path: '/submission/:id', name: 'submission', component: submission},
|
{path: '/submission/:id', name: 'submission', component: submission, meta: {layout: 'simple'}},
|
||||||
{
|
{
|
||||||
path: '/book',
|
path: '/book',
|
||||||
name: 'book',
|
name: 'book',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
.article {
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
grid-template-rows: 50px minmax(50px, max-content) auto;
|
||||||
|
grid-row-gap: 30px;
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
border-bottom: 1px solid $color-lightgrey;
|
||||||
|
align-self: end;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
grid-row: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
grid-row: 2;
|
||||||
|
font-family: $serif-font-family;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__content {
|
||||||
|
display: -ms-grid;
|
||||||
|
display: grid;
|
||||||
|
grid-row-gap: 40px;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
|
||||||
|
/deep/ p {
|
||||||
|
font-size: toRem(18px);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,3 +11,4 @@
|
||||||
@import "uploadcare_overwrite";
|
@import "uploadcare_overwrite";
|
||||||
@import "help-text";
|
@import "help-text";
|
||||||
@import "objective-group";
|
@import "objective-group";
|
||||||
|
@import "article";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue