Merge branch 'develop'
This commit is contained in:
commit
f204122540
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="assignment-with-submissions">
|
<div class="assignment-with-submissions">
|
||||||
<h1 class="assignment-with-submissions__title">{{assignment.title}}</h1>
|
<!--<h1 class="assignment-with-submissions__title">{{assignment.assignment}}</h1>-->
|
||||||
<h4 class="assignment-with-submissions__heading">Aufgabe</h4>
|
<h4 class="assignment-with-submissions__heading">Aufgabe</h4>
|
||||||
|
|
||||||
<p class="assignment-with-submissions__text">{{assignment.assignment}}</p>
|
<p class="assignment-with-submissions__text">{{assignment.assignment}}</p>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
<content-block :contentBlock="contentBlock"
|
<content-block :contentBlock="contentBlock"
|
||||||
:parent="chapter.id"
|
:parent="chapter.id"
|
||||||
:key="contentBlock.id" v-for="contentBlock in chapter.contentBlocks">
|
:key="contentBlock.id" v-for="contentBlock in filteredContentBlocks">
|
||||||
</content-block>
|
</content-block>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
import AddContentBlockButton from '@/components/AddContentBlockButton';
|
import AddContentBlockButton from '@/components/AddContentBlockButton';
|
||||||
|
|
||||||
import {mapGetters} from 'vuex';
|
import {mapGetters} from 'vuex';
|
||||||
|
import {isHidden} from '@/helpers/content-block';
|
||||||
|
import {meQuery} from '@/graphql/queries';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['chapter', 'index'],
|
props: ['chapter', 'index'],
|
||||||
|
|
@ -30,8 +32,30 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['editModule'])
|
...mapGetters(['editModule']),
|
||||||
|
filteredContentBlocks() {
|
||||||
|
if (!(this.chapter && this.chapter.contentBlocks)) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
if (this.editModule) {
|
||||||
|
return this.chapter.contentBlocks;
|
||||||
|
}
|
||||||
|
return this.chapter.contentBlocks.filter(contentBlock => !isHidden(contentBlock, this.schoolClass));
|
||||||
|
},
|
||||||
|
schoolClass() {
|
||||||
|
return this.me.selectedClass;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
me: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
apollo: {
|
||||||
|
me: meQuery
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="content-block__container" :class="{'content-block__container--hidden': hidden}">
|
<div class="content-block__container" :class="{'content-block__container--hidden': hidden}">
|
||||||
<div class="content-block" :class="specialClass">
|
<div class="content-block" :class="specialClass">
|
||||||
<div class="content-block__actions" v-if="canEditContentBlock">
|
<div class="content-block__actions" v-if="canEditContentBlock && editModule">
|
||||||
<user-widget v-bind="me" class="content-block__user-widget"></user-widget>
|
<user-widget v-bind="me" class="content-block__user-widget"></user-widget>
|
||||||
<more-options-widget>
|
<more-options-widget>
|
||||||
<li class="popover-links__link"><a @click="deleteContentBlock()">Löschen</a></li>
|
<li class="popover-links__link"><a @click="deleteContentBlock()">Löschen</a></li>
|
||||||
<li class="popover-links__link"><a @click="editContentBlock()">Bearbeiten</a></li>
|
<li class="popover-links__link"><a @click="editContentBlock()">Bearbeiten</a></li>
|
||||||
</more-options-widget>
|
</more-options-widget>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-block__visibility">
|
<div class="content-block__visibility" v-if="editModule">
|
||||||
<visibility-action
|
<visibility-action
|
||||||
v-if="!contentBlock.indent"
|
v-if="!contentBlock.indent"
|
||||||
:block="contentBlock"></visibility-action>
|
:block="contentBlock"></visibility-action>
|
||||||
|
|
@ -69,6 +69,8 @@
|
||||||
|
|
||||||
import {mapGetters} from 'vuex';
|
import {mapGetters} from 'vuex';
|
||||||
|
|
||||||
|
import {isHidden} from '@/helpers/content-block';
|
||||||
|
|
||||||
const instruments = {
|
const instruments = {
|
||||||
base_communication: 'Sprache & Kommunikation',
|
base_communication: 'Sprache & Kommunikation',
|
||||||
base_society: 'Gesellschaft'
|
base_society: 'Gesellschaft'
|
||||||
|
|
@ -174,14 +176,7 @@
|
||||||
return this.me.selectedClass;
|
return this.me.selectedClass;
|
||||||
},
|
},
|
||||||
hidden() {
|
hidden() {
|
||||||
if (this.contentBlock.userCreated) {
|
return isHidden(this.contentBlock, this.schoolClass);
|
||||||
if (this.schoolClass.id === '') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !this.contentBlock.visibleFor.map(entry => entry.id).includes(this.schoolClass.id);
|
|
||||||
} else {
|
|
||||||
return this.contentBlock.hiddenFor.map(entry => entry.id).includes(this.schoolClass.id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -260,7 +255,7 @@
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: rgba(255,255,255,0.5);
|
background: rgba(255, 255, 255, 0.5);
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -285,7 +280,7 @@
|
||||||
&__actions {
|
&__actions {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 10px;
|
||||||
right: -45px;
|
right: -85px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<nav class="module-navigation sub-navigation">
|
<nav class="module-navigation sub-navigation" v-if="canManageContent">
|
||||||
<div class="sub-navigation-item">
|
<div class="sub-navigation-item">
|
||||||
<router-link class="sub-navigation-item__title" :to="moduleContentLink">Modul</router-link>
|
<router-link class="sub-navigation-item__title" :to="moduleContentLink">Modul</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
>{{assignmentTitle(assignment)}}
|
>{{assignmentTitle(assignment)}}
|
||||||
</router-link>
|
</router-link>
|
||||||
</sub-navigation-item>
|
</sub-navigation-item>
|
||||||
<div class="module-navigation__module-content" v-if="false">
|
<div class="module-navigation__module-content" v-if="false"> <!-- Do not display this for now, might be used later again though -->
|
||||||
<router-link
|
<router-link
|
||||||
tag="h3"
|
tag="h3"
|
||||||
:to="moduleContentLink"
|
:to="moduleContentLink"
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="module-navigation__toggle-menu" v-if="canManageContent">
|
<div class="module-navigation__toggle-menu">
|
||||||
<toggle-editing></toggle-editing>
|
<toggle-editing></toggle-editing>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
return `/module/${this.module.slug}/submissions/${assignment.id}`;
|
return `/module/${this.module.slug}/submissions/${assignment.id}`;
|
||||||
},
|
},
|
||||||
assignmentTitle(assignment) {
|
assignmentTitle(assignment) {
|
||||||
return assignment.title.length > 25 ? assignment.title.substring(0, 22) + '...' : assignment.title;
|
return assignment.assignment.length > 25 ? assignment.assignment.substring(0, 22) + '...' : assignment.assignment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,17 @@
|
||||||
export function setUserBlockType(isAssignment) {
|
export function setUserBlockType(isAssignment) {
|
||||||
return isAssignment ? 'TASK' : 'NORMAL';
|
return isAssignment ? 'TASK' : 'NORMAL';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const isHidden = (contentBlock, schoolClass) => {
|
||||||
|
if (!contentBlock.id || !contentBlock.visibleFor || !contentBlock.hiddenFor) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (contentBlock.userCreated) {
|
||||||
|
if (schoolClass.id === '') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !contentBlock.visibleFor.map(entry => entry.id).includes(schoolClass.id);
|
||||||
|
} else {
|
||||||
|
return contentBlock.hiddenFor.map(entry => entry.id).includes(schoolClass.id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,10 @@ class MutateContentBlock(relay.ClientIDMutation):
|
||||||
|
|
||||||
content_block = get_object(ContentBlock, id_param)
|
content_block = get_object(ContentBlock, id_param)
|
||||||
|
|
||||||
block_type = content_block_data.get('type', content_block.type.upper())
|
block_type = content_block_data.get('type')
|
||||||
|
if block_type is not None: # only change the type if the user has set a type
|
||||||
|
content_block.type = set_user_defined_block_type(block_type)
|
||||||
|
|
||||||
module = content_block.get_parent().get_parent().specific
|
module = content_block.get_parent().get_parent().specific
|
||||||
|
|
||||||
if visibility_list is not None:
|
if visibility_list is not None:
|
||||||
|
|
@ -48,7 +51,7 @@ class MutateContentBlock(relay.ClientIDMutation):
|
||||||
if contents is not None:
|
if contents is not None:
|
||||||
content_block.contents = json.dumps([handle_content_block(c, info.context, module) for c in contents])
|
content_block.contents = json.dumps([handle_content_block(c, info.context, module) for c in contents])
|
||||||
|
|
||||||
content_block.type = set_user_defined_block_type(block_type)
|
|
||||||
content_block.save()
|
content_block.save()
|
||||||
|
|
||||||
return cls(content_block=content_block)
|
return cls(content_block=content_block)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue