Skip to content
Snippets Groups Projects
Commit ce432075 authored by \nrlucke's avatar \nrlucke
Browse files

fixes #114

parent 3be9204b
No related branches found
No related tags found
No related merge requests found
...@@ -1348,11 +1348,11 @@ $icons: ( ...@@ -1348,11 +1348,11 @@ $icons: (
.cw-tabs { .cw-tabs {
.cw-tab { .cw-tab {
visibility: hidden; display: none;
height: 0; height: 0;
&.cw-tab-active { &.cw-tab-active {
visibility: visible; display: block;
height: unset; height: unset;
} }
} }
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<template v-slot:containerContent> <template v-slot:containerContent>
<courseware-tabs> <courseware-tabs>
<courseware-tab <courseware-tab
v-for="(section, index) in container.attributes.payload.sections" v-for="(section, index) in currentSections"
:key="index" :key="index"
:index="index" :index="index"
:name="section.name" :name="section.name"
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
:selected="index === 0" :selected="index === 0"
> >
<ul class="cw-container-tabs-block-list"> <ul class="cw-container-tabs-block-list">
<li v-for="block in blocks" :key="block.id" class="cw-block-item"> <li v-for="block in section.blocks" :key="block.id" class="cw-block-item">
<component <component
v-if="section.blocks.includes(block.id)" v-if="section.blocks.includes(block.id)"
:is="component(block)" :is="component(block)"
...@@ -96,7 +96,8 @@ export default { ...@@ -96,7 +96,8 @@ export default {
}, },
data() { data() {
return { return {
currentContainer: {}, currentContainer: null,
currentSections: [],
textDeleteSection: this.$gettext('Sektion entfernen'), textDeleteSection: this.$gettext('Sektion entfernen'),
selectAttributes: {'ref': 'openIndicator', 'role': 'presentation', 'class': 'vs__open-indicator'} selectAttributes: {'ref': 'openIndicator', 'role': 'presentation', 'class': 'vs__open-indicator'}
}; };
...@@ -130,6 +131,14 @@ export default { ...@@ -130,6 +131,14 @@ export default {
initCurrentData() { initCurrentData() {
// clone container to make edit reversible // clone container to make edit reversible
this.currentContainer = JSON.parse(JSON.stringify(this.container)); this.currentContainer = JSON.parse(JSON.stringify(this.container));
let view = this;
let sections = this.currentContainer.attributes.payload.sections;
sections.forEach(section => {
section.blocks = section.blocks.map((id) => view.blockById({id}));
});
this.currentSections = sections;
}, },
addSection() { addSection() {
this.currentContainer.attributes.payload.sections.push({ name: '', icon: '', blocks: [] }); this.currentContainer.attributes.payload.sections.push({ name: '', icon: '', blocks: [] });
...@@ -164,7 +173,11 @@ export default { ...@@ -164,7 +173,11 @@ export default {
this.initCurrentData(); this.initCurrentData();
}, },
component(block) { component(block) {
return 'courseware-' + block.attributes["block-type"] + '-block'; if (block.attributes) {
return 'courseware-' + block.attributes["block-type"] + '-block';
} else {
console.debug(block);
}
}, },
updateContent(blockAdder) { updateContent(blockAdder) {
if(blockAdder.container.id === this.container.id) { if(blockAdder.container.id === this.container.id) {
...@@ -172,5 +185,10 @@ export default { ...@@ -172,5 +185,10 @@ export default {
} }
} }
}, },
watch: {
blocks() {
this.initCurrentData();
}
}
}; };
</script> </script>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment