Add toggle for module editing
This commit is contained in:
parent
8bd6d51028
commit
a4cf7a0d62
|
|
@ -6,7 +6,7 @@
|
||||||
{{chapter.description}}
|
{{chapter.description}}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<add-content-block-button :parent="chapter.id"></add-content-block-button>
|
<add-content-block-button :parent="chapter.id" v-if="editModule"></add-content-block-button>
|
||||||
|
|
||||||
<content-block :contentBlock="contentBlock"
|
<content-block :contentBlock="contentBlock"
|
||||||
:parent="chapter.id"
|
:parent="chapter.id"
|
||||||
|
|
@ -19,6 +19,8 @@
|
||||||
import ContentBlock from '@/components/ContentBlock';
|
import ContentBlock from '@/components/ContentBlock';
|
||||||
import AddContentBlockButton from '@/components/AddContentBlockButton';
|
import AddContentBlockButton from '@/components/AddContentBlockButton';
|
||||||
|
|
||||||
|
import {mapGetters} from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['chapter', 'index'],
|
props: ['chapter', 'index'],
|
||||||
|
|
||||||
|
|
@ -36,6 +38,7 @@
|
||||||
currentFilter() {
|
currentFilter() {
|
||||||
return this.$store.state.filterForSchoolClass;
|
return this.$store.state.filterForSchoolClass;
|
||||||
},
|
},
|
||||||
|
...mapGetters(['editModule'])
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="content-block__container">
|
<div class="content-block__container">
|
||||||
<div class="content-block" :class="specialClass">
|
<div class="content-block" :class="specialClass">
|
||||||
<!--div class="content-block__actions">
|
<div class="content-block__actions">
|
||||||
<visibility-action
|
<visibility-action
|
||||||
v-if="!contentBlock.indent"
|
v-if="!contentBlock.indent"
|
||||||
:block="contentBlock"></visibility-action>
|
:block="contentBlock"></visibility-action>
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<a @click="deleteContentBlock(contentBlock.id)" v-if="canEditContentBlock" class="content-block__action-button">
|
<a @click="deleteContentBlock(contentBlock.id)" v-if="canEditContentBlock" class="content-block__action-button">
|
||||||
<trash-icon class="content-block__action-icon action-icon"></trash-icon>
|
<trash-icon class="content-block__action-icon action-icon"></trash-icon>
|
||||||
</a>
|
</a>
|
||||||
</div-->
|
</div>
|
||||||
|
|
||||||
<h3 v-if="instrumentLabel !== ''" class="content-block__instrument-label">{{instrumentLabel}}</h3>
|
<h3 v-if="instrumentLabel !== ''" class="content-block__instrument-label">{{instrumentLabel}}</h3>
|
||||||
<h4 class="content-block__title" v-if="!contentBlock.indent">{{contentBlock.title}}</h4>
|
<h4 class="content-block__title" v-if="!contentBlock.indent">{{contentBlock.title}}</h4>
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<add-content-block-button :after="contentBlock.id" v-if="!contentBlock.indent"></add-content-block-button>
|
<add-content-block-button :after="contentBlock.id" v-if="!contentBlock.indent && editModule"></add-content-block-button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -54,6 +54,8 @@
|
||||||
import CHAPTER_QUERY from '@/graphql/gql/chapterQuery.gql';
|
import CHAPTER_QUERY from '@/graphql/gql/chapterQuery.gql';
|
||||||
import DELETE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/deleteContentBlock.gql';
|
import DELETE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/deleteContentBlock.gql';
|
||||||
|
|
||||||
|
import {mapGetters} from 'vuex';
|
||||||
|
|
||||||
const instruments = {
|
const instruments = {
|
||||||
base_communication: 'Sprache & Kommunikation',
|
base_communication: 'Sprache & Kommunikation',
|
||||||
base_society: 'Gesellschaft'
|
base_society: 'Gesellschaft'
|
||||||
|
|
@ -87,6 +89,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapGetters(['editModule']),
|
||||||
specialClass() {
|
specialClass() {
|
||||||
return `content-block--${this.contentBlock.type.toLowerCase()}`
|
return `content-block--${this.contentBlock.type.toLowerCase()}`
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@
|
||||||
module: {
|
module: {
|
||||||
required: true,
|
required: true,
|
||||||
type: Object
|
type: Object
|
||||||
|
},
|
||||||
|
edit: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="module-navigation__toggle-menu">
|
||||||
|
<toggle-editing></toggle-editing>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!--toggle-solutions-for-module
|
<!--toggle-solutions-for-module
|
||||||
v-if="onModulePage && module.id"
|
v-if="onModulePage && module.id"
|
||||||
:module="module.id"
|
:module="module.id"
|
||||||
|
|
@ -47,7 +51,8 @@
|
||||||
import ME_QUERY from '@/graphql/gql/meQuery.gql';
|
import ME_QUERY from '@/graphql/gql/meQuery.gql';
|
||||||
|
|
||||||
import SubNavigationItem from '@/components/book-navigation/SubNavigationItem';
|
import SubNavigationItem from '@/components/book-navigation/SubNavigationItem';
|
||||||
import ToggleSolutionsForModule from '@/components/ToggleSolutionsForModule';
|
import ToggleSolutionsForModule from '@/components/toggle-menu/ToggleSolutionsForModule';
|
||||||
|
import ToggleEditing from '@/components/toggle-menu/ToggleEditing';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
apollo: {
|
apollo: {
|
||||||
|
|
@ -59,7 +64,8 @@
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
SubNavigationItem,
|
SubNavigationItem,
|
||||||
ToggleSolutionsForModule
|
ToggleSolutionsForModule,
|
||||||
|
ToggleEditing
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -154,7 +160,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__solution-toggle {
|
&__toggle-menu {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<template>
|
||||||
|
<div class="toggle-editing">
|
||||||
|
<checkbox label="Modul anpassen" :checked="checked" @input="toggle"></checkbox>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Checkbox from '@/components/Checkbox';
|
||||||
|
import { mapGetters, mapActions } from 'vuex';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Checkbox,
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
|
checked: 'editModule',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
...mapActions({
|
||||||
|
toggle: 'editModule'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<module :module="module" v-if="module.id"></module>
|
<module :module="module" v-if="module.id" :edit="editModule"></module>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
...mapGetters({
|
||||||
scrollToAssignmentId: 'scrollToAssignmentId',
|
scrollToAssignmentId: 'scrollToAssignmentId',
|
||||||
isScrollingToAssignment: 'scrollingToAssignment'
|
isScrollingToAssignment: 'scrollingToAssignment',
|
||||||
|
editModule: 'editModule'
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ export default new Vuex.Store({
|
||||||
vimeoId: null,
|
vimeoId: null,
|
||||||
scrollToAssignmentId: '',
|
scrollToAssignmentId: '',
|
||||||
scrollToAssignmentReady: false,
|
scrollToAssignmentReady: false,
|
||||||
scrollingToAssignment: false
|
scrollingToAssignment: false,
|
||||||
|
editModule: false
|
||||||
},
|
},
|
||||||
|
|
||||||
getters: {
|
getters: {
|
||||||
|
|
@ -43,6 +44,7 @@ export default new Vuex.Store({
|
||||||
scrollToAssignmentReady: state => state.scrollToAssignmentReady,
|
scrollToAssignmentReady: state => state.scrollToAssignmentReady,
|
||||||
scrollingToAssignment: state => state.scrollingToAssignment,
|
scrollingToAssignment: state => state.scrollingToAssignment,
|
||||||
currentProjectEntry: state => state.currentProjectEntry,
|
currentProjectEntry: state => state.currentProjectEntry,
|
||||||
|
editModule: state => state.editModule
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
@ -147,6 +149,9 @@ export default new Vuex.Store({
|
||||||
commit('setScrollingToAssignment', false);
|
commit('setScrollingToAssignment', false);
|
||||||
dispatch('scrollToAssignmentId', '');
|
dispatch('scrollToAssignmentId', '');
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
editModule({commit}, payload) {
|
||||||
|
commit('setEditModule', payload)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -213,6 +218,9 @@ export default new Vuex.Store({
|
||||||
},
|
},
|
||||||
setScrollingToAssignment(state, payload) {
|
setScrollingToAssignment(state, payload) {
|
||||||
state.scrollingToAssignment = payload;
|
state.scrollingToAssignment = payload;
|
||||||
|
},
|
||||||
|
setEditModule(state, payload) {
|
||||||
|
state.editModule = payload;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue