Skip to content
Snippets Groups Projects
Commit 2898085c authored by Ron Lucke's avatar Ron Lucke Committed by Jan-Hendrik Willms
Browse files

fix #4344

Closes #4344

Merge request studip/studip!3172
parent 4ca88e3b
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
{{ $gettext('Drücken Sie die Leertaste, um neu anzuordnen.') }} {{ $gettext('Drücken Sie die Leertaste, um neu anzuordnen.') }}
</span> </span>
</template> </template>
<courseware-tabs> <courseware-tabs @selectTab="selectTabHandler">
<courseware-tab <courseware-tab
v-for="(section, index) in currentSections" v-for="(section, index) in currentSections"
:key="index" :key="index"
...@@ -205,6 +205,7 @@ export default { ...@@ -205,6 +205,7 @@ export default {
loadContainer: 'courseware-containers/loadById', loadContainer: 'courseware-containers/loadById',
lockObject: 'lockObject', lockObject: 'lockObject',
unlockObject: 'unlockObject', unlockObject: 'unlockObject',
storeContainerRecord: 'courseware-containers/storeRecord'
}), }),
initCurrentData() { initCurrentData() {
this.currentContainer = _.cloneDeep(this.container); this.currentContainer = _.cloneDeep(this.container);
...@@ -402,6 +403,18 @@ export default { ...@@ -402,6 +403,18 @@ export default {
, {blockTitle: block.attributes.title, pos: currentIndex + 1, listLength: this.currentSections[sectionIndex].blocks.length} , {blockTitle: block.attributes.title, pos: currentIndex + 1, listLength: this.currentSections[sectionIndex].blocks.length}
); );
this.storeSort(); this.storeSort();
},
selectTabHandler(event) {
const tabIndex = event.index;
let container = _.cloneDeep(this.container);
container.activeSection = tabIndex;
this.storeContainerRecord(container);
if (this.blockAdder.container.id === this.container.id) {
this.setAdderStorage({
container: this.container,
section: tabIndex
});
}
} }
}, },
watch: { watch: {
......
...@@ -253,9 +253,11 @@ const containerMixin = { ...@@ -253,9 +253,11 @@ const containerMixin = {
// choose the last container and its last section as the default adder slot // choose the last container and its last section as the default adder slot
// for adding blocks and containers via click // for adding blocks and containers via click
if (this.containers) { if (this.containers) {
const lastContainer = this.containers[this.containers.length - 1];
const section = lastContainer.activeSection ?? 0;
this.setAdderStorage({ this.setAdderStorage({
container: this.containers[this.containers.length - 1], container: lastContainer,
section: this.containers[this.containers.length - 1].attributes.payload.sections.length - 1 section: section
}); });
} }
}, },
......
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