Refactor graphql query location
This commit is contained in:
parent
85a3131680
commit
4ea598b700
|
|
@ -134,7 +134,7 @@
|
||||||
title: this.contentBlock.title,
|
title: this.contentBlock.title,
|
||||||
contents: [...this.contentBlock.contents],
|
contents: [...this.contentBlock.contents],
|
||||||
id: this.contentBlock.id || undefined,
|
id: this.contentBlock.id || undefined,
|
||||||
isAssignment: this.contentBlock.type && this.contentBlock.type === 'TASK'
|
isAssignment: this.contentBlock.type && this.contentBlock.type.toLowerCase() === 'task'
|
||||||
}),
|
}),
|
||||||
me: {}
|
me: {}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
import store from '@/store/index';
|
import store from '@/store/index';
|
||||||
|
|
||||||
import EDIT_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/mutateContentBlock.gql';
|
import EDIT_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/mutateContentBlock.gql';
|
||||||
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/moduleDetailsQuery.gql';
|
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
|
||||||
import CONTENT_BLOCK_QUERY from '@/graphql/gql/queries/contentBlockQuery.gql';
|
import CONTENT_BLOCK_QUERY from '@/graphql/gql/queries/contentBlockQuery.gql';
|
||||||
import { setUserBlockType } from '@/helpers/content-block';
|
import { setUserBlockType } from '@/helpers/content-block';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
import ContentsForm from '@/components/content-block-form/ContentsForm';
|
import ContentsForm from '@/components/content-block-form/ContentsForm';
|
||||||
|
|
||||||
import NEW_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/addContentBlock.gql';
|
import NEW_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/addContentBlock.gql';
|
||||||
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/moduleDetailsQuery.gql';
|
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
|
||||||
import {setUserBlockType} from '@/helpers/content-block';
|
import {setUserBlockType} from '@/helpers/content-block';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,141 @@
|
||||||
|
<template>
|
||||||
|
<div class="module">
|
||||||
|
<h2
|
||||||
|
class="module__meta-title"
|
||||||
|
id="meta-title">{{ module.metaTitle }}</h2>
|
||||||
|
<h1
|
||||||
|
class="module__title"
|
||||||
|
data-cy="module-title">{{ module.title }}</h1>
|
||||||
|
<img
|
||||||
|
:src="module.heroImage"
|
||||||
|
alt=""
|
||||||
|
class="module__hero">
|
||||||
|
|
||||||
|
<div class="module__intro-wrapper">
|
||||||
|
<bookmark-actions
|
||||||
|
:bookmarked="module.bookmark"
|
||||||
|
:note="note"
|
||||||
|
class="module__bookmark-actions"
|
||||||
|
@add-note="$emit('addNote')"
|
||||||
|
@edit-note="$emit('editNote')"
|
||||||
|
@bookmark="$emit('bookmark', !module.bookmark)"/>
|
||||||
|
<div
|
||||||
|
class="module__intro intro"
|
||||||
|
v-html="module.intro"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h3 id="objectives">Lernziele</h3>
|
||||||
|
|
||||||
|
<div class="module__objective-groups">
|
||||||
|
<objective-groups :groups="languageCommunicationObjectiveGroups"/>
|
||||||
|
|
||||||
|
<objective-groups :groups="societyObjectiveGroups"/>
|
||||||
|
|
||||||
|
<objective-groups :groups="interdisciplinaryObjectiveGroups"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<chapter
|
||||||
|
:chapter="chapter"
|
||||||
|
:index="index"
|
||||||
|
:key="chapter.id"
|
||||||
|
v-for="(chapter, index) in module.chapters"/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ObjectiveGroups from '@/components/objective-groups/ObjectiveGroups.vue';
|
||||||
|
import Chapter from '@/components/Chapter.vue';
|
||||||
|
import BookmarkActions from '@/components/notes/BookmarkActions';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
props: {
|
||||||
|
module: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
BookmarkActions,
|
||||||
|
ObjectiveGroups,
|
||||||
|
Chapter,
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
languageCommunicationObjectiveGroups() {
|
||||||
|
return this.module.objectiveGroups ? this.module.objectiveGroups
|
||||||
|
.filter(group => group.title === 'LANGUAGE_COMMUNICATION') : [];
|
||||||
|
},
|
||||||
|
societyObjectiveGroups() {
|
||||||
|
return this.module.objectiveGroups ? this.module.objectiveGroups
|
||||||
|
.filter(group => group.title === 'SOCIETY') : [];
|
||||||
|
},
|
||||||
|
interdisciplinaryObjectiveGroups() {
|
||||||
|
return this.module.objectiveGroups ? this.module.objectiveGroups
|
||||||
|
.filter(group => group.title === 'INTERDISCIPLINARY') : [];
|
||||||
|
},
|
||||||
|
isStudent() {
|
||||||
|
return !this.me.permissions.includes('users.can_manage_school_class_content');
|
||||||
|
},
|
||||||
|
note() {
|
||||||
|
if (!(this.module && this.module.bookmark)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return this.module.bookmark.note;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import '~styles/helpers';
|
||||||
|
|
||||||
|
.module {
|
||||||
|
display: flex;
|
||||||
|
justify-self: center;
|
||||||
|
max-width: 100vw;
|
||||||
|
|
||||||
|
@include desktop {
|
||||||
|
width: 800px;
|
||||||
|
}
|
||||||
|
flex-direction: column;
|
||||||
|
padding: $large-spacing 15px;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&__hero {
|
||||||
|
margin-bottom: 35px;
|
||||||
|
border-radius: 12px;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta-title {
|
||||||
|
@include meta-title;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__intro-wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__intro {
|
||||||
|
> /deep/ p {
|
||||||
|
font-size: toRem(25px);
|
||||||
|
margin-bottom: $large-spacing;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__bookmark-actions {
|
||||||
|
margin-top: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__objective-groups {
|
||||||
|
margin-bottom: $large-spacing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
import NoteForm from '@/components/notes/NoteForm';
|
import NoteForm from '@/components/notes/NoteForm';
|
||||||
|
|
||||||
import UPDATE_NOTE_MUTATION from '@/graphql/gql/mutations/updateNote.gql';
|
import UPDATE_NOTE_MUTATION from '@/graphql/gql/mutations/updateNote.gql';
|
||||||
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/moduleDetailsQuery.gql';
|
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
|
||||||
import INSTRUMENT_QUERY from '@/graphql/gql/queries/instrumentQuery.gql';
|
import INSTRUMENT_QUERY from '@/graphql/gql/queries/instrumentQuery.gql';
|
||||||
|
|
||||||
import {mapGetters} from 'vuex';
|
import {mapGetters} from 'vuex';
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
import MoreOptionsWidget from '@/components/MoreOptionsWidget';
|
import MoreOptionsWidget from '@/components/MoreOptionsWidget';
|
||||||
|
|
||||||
import DELETE_OBJECTIVE_MUTATION from '@/graphql/gql/mutations/deleteObjective.gql';
|
import DELETE_OBJECTIVE_MUTATION from '@/graphql/gql/mutations/deleteObjective.gql';
|
||||||
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/moduleDetailsQuery.gql';
|
import MODULE_DETAILS_QUERY from '@/graphql/gql/queries/modules/moduleDetailsQuery.gql';
|
||||||
import {hidden} from '@/helpers/visibility';
|
import {hidden} from '@/helpers/visibility';
|
||||||
import {OBJECTIVE_TYPE} from '@/consts/types';
|
import {OBJECTIVE_TYPE} from '@/consts/types';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,6 @@ fragment ChapterParts on ChapterNode {
|
||||||
text
|
text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentBlocks {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
...ContentBlockParts
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
titleHiddenFor {
|
titleHiddenFor {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
#import "../fragments/chapterParts.gql"
|
#import "../fragments/chapterParts.gql"
|
||||||
|
#import "../fragments/contentBlockParts.gql"
|
||||||
mutation UpdateChapterVisibility($input: UpdateChapterVisibilityInput!) {
|
mutation UpdateChapterVisibility($input: UpdateChapterVisibilityInput!) {
|
||||||
updateChapterVisibility(input: $input) {
|
updateChapterVisibility(input: $input) {
|
||||||
chapter {
|
chapter {
|
||||||
...ChapterParts
|
...ChapterParts
|
||||||
|
contentBlocks {
|
||||||
|
...ContentBlockParts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
#import "../fragments/chapterParts.gql"
|
#import "../fragments/chapterParts.gql"
|
||||||
|
#import "../fragments/contentBlockParts.gql"
|
||||||
query ChapterQuery($id: ID!) {
|
query ChapterQuery($id: ID!) {
|
||||||
chapter(id: $id) {
|
chapter(id: $id) {
|
||||||
...ChapterParts
|
...ChapterParts
|
||||||
|
contentBlocks {
|
||||||
|
...ContentBlockParts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
#import "../fragments/chapterParts.gql"
|
#import "../../fragments/chapterParts.gql"
|
||||||
#import "../fragments/assignmentParts.gql"
|
#import "../../fragments/assignmentParts.gql"
|
||||||
#import "../fragments/objectiveGroupParts.gql"
|
#import "../../fragments/objectiveGroupParts.gql"
|
||||||
#import "../fragments/objectiveParts.gql"
|
#import "../../fragments/objectiveParts.gql"
|
||||||
#import "../fragments/moduleParts.gql"
|
#import "../../fragments/moduleParts.gql"
|
||||||
|
#import "../../fragments/contentBlockParts.gql"
|
||||||
query ModuleDetailsQuery($slug: String!) {
|
query ModuleDetailsQuery($slug: String!) {
|
||||||
module(slug: $slug) {
|
module(slug: $slug) {
|
||||||
...ModuleParts
|
...ModuleParts
|
||||||
|
|
@ -31,6 +32,9 @@ query ModuleDetailsQuery($slug: String!) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...ChapterParts
|
...ChapterParts
|
||||||
|
contentBlocks {
|
||||||
|
...ContentBlockParts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,6 +7,9 @@ query SnapshotDetail($id: ID!) {
|
||||||
title
|
title
|
||||||
titleHidden
|
titleHidden
|
||||||
descriptionHidden
|
descriptionHidden
|
||||||
|
contentBlocks {
|
||||||
|
id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import MODULE_DETAILS_QUERY from './gql/queries/moduleDetailsQuery.gql';
|
import MODULE_DETAILS_QUERY from './gql/queries/modules/moduleDetailsQuery.gql';
|
||||||
import ME_QUERY from './gql/queries/meQuery.gql';
|
import ME_QUERY from './gql/queries/meQuery.gql';
|
||||||
|
|
||||||
export function moduleQuery() {
|
export function moduleQuery() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue