From 3759c3248b0ca775c045ec4336748a6668b3eba5 Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Wed, 6 Jul 2022 13:01:07 +0200 Subject: [PATCH] Revert "fix #887" This reverts commit be15fc8a6117c71c3d50bbd0ae8999e1c49b12ad. --- .../JsonApi/Routes/Courseware/Authority.php | 31 +---- .../assets/stylesheets/scss/courseware.scss | 63 +++------- .../CoursewareAccordionContainer.vue | 11 +- .../courseware/CoursewareActionWidget.vue | 4 +- .../courseware/CoursewareAudioBlock.vue | 42 +------ .../courseware/CoursewareBeforeAfterBlock.vue | 111 +++++------------- .../courseware/CoursewareBlockActions.vue | 99 +++++++--------- .../courseware/CoursewareCanvasBlock.vue | 51 ++------ .../courseware/CoursewareChartBlock.vue | 28 +---- .../courseware/CoursewareCodeBlock.vue | 19 +-- .../courseware/CoursewareConfirmBlock.vue | 14 +-- .../courseware/CoursewareContainerActions.vue | 54 ++------- .../courseware/CoursewareDateBlock.vue | 43 +------ .../courseware/CoursewareDefaultBlock.vue | 58 +-------- .../courseware/CoursewareDefaultContainer.vue | 56 +-------- .../courseware/CoursewareDialogCardsBlock.vue | 24 +--- .../courseware/CoursewareDocumentBlock.vue | 67 +++-------- .../courseware/CoursewareDownloadBlock.vue | 37 +----- .../courseware/CoursewareEmbedBlock.vue | 45 +------ .../courseware/CoursewareEmptyElementBox.vue | 6 +- .../courseware/CoursewareFolderBlock.vue | 39 ++---- .../courseware/CoursewareGalleryBlock.vue | 39 +----- .../courseware/CoursewareHeadlineBlock.vue | 69 +---------- .../courseware/CoursewareIframeBlock.vue | 62 +--------- .../courseware/CoursewareImageMapBlock.vue | 55 +++------ .../courseware/CoursewareKeyPointBlock.vue | 25 +--- .../courseware/CoursewareLinkBlock.vue | 29 +---- .../CoursewareStructuralElement.vue | 21 ++-- .../CoursewareTableOfContentsBlock.vue | 24 +--- .../courseware/CoursewareTabsContainer.vue | 11 +- .../courseware/CoursewareTypewriterBlock.vue | 40 ++----- .../courseware/CoursewareVideoBlock.vue | 56 +-------- .../vue/components/courseware/IndexApp.vue | 15 +-- .../vue/components/courseware/block-mixin.js | 6 - .../vue/store/courseware/courseware.module.js | 2 +- 35 files changed, 225 insertions(+), 1131 deletions(-) diff --git a/lib/classes/JsonApi/Routes/Courseware/Authority.php b/lib/classes/JsonApi/Routes/Courseware/Authority.php index b401855c009..5e30a415ceb 100755 --- a/lib/classes/JsonApi/Routes/Courseware/Authority.php +++ b/lib/classes/JsonApi/Routes/Courseware/Authority.php @@ -59,13 +59,7 @@ class Authority public static function canUpdateBlock(User $user, Block $resource) { if ($resource->isBlocked()) { - $perm = $GLOBALS['perm']->have_studip_perm( - $resource->container->structural_element->course->config->COURSEWARE_EDITING_PERMISSION, - $resource->container->structural_element->course->id, - $user->id - ); - - return $resource->getBlockerUserId() == $user->id || $perm; + return $resource->getBlockerUserId() == $user->id; } return self::canUpdateContainer($user, $resource->container); @@ -78,28 +72,7 @@ class Authority public static function canUpdateEditBlocker(User $user, $resource) { - $structural_element = null; - if ($resource instanceof Block) { - $structural_element = $resource->container->structural_element; - } - if ($resource instanceof Container) { - $structural_element = $resource->structural_element; - } - if ($resource instanceof StructuralElement) { - $structural_element = $resource; - } - - if ($structural_element === null) { - return false; - } - - $perm = $GLOBALS['perm']->have_studip_perm( - $structural_element->course->config->COURSEWARE_EDITING_PERMISSION, - $structural_element->course->id, - $user->id - ); - - return $resource->edit_blocker_id == '' || $resource->edit_blocker_id === $user->id || $perm; + return $resource->edit_blocker_id == '' || $resource->edit_blocker_id === $user->id; } public static function canShowContainer(User $user, Container $resource) diff --git a/resources/assets/stylesheets/scss/courseware.scss b/resources/assets/stylesheets/scss/courseware.scss index 52431eb2a93..739b1d320f3 100755 --- a/resources/assets/stylesheets/scss/courseware.scss +++ b/resources/assets/stylesheets/scss/courseware.scss @@ -770,14 +770,6 @@ ribbon end font-weight: 700; line-height: 2em; font-size: 1.1em; - - &.cw-default-container-blocker-warning { - font-weight: 400; - } - } - - img { - vertical-align: text-bottom; } .cw-container-actions { @@ -874,6 +866,12 @@ form.cw-container-dialog-edit-form { .cw-default-block { display: flex; flex-flow: row; + .cw-default-block-invisible-info { + img { + vertical-align: text-bottom; + } + } + } .cw-content-wrapper { display: flex; @@ -908,19 +906,10 @@ form.cw-container-dialog-edit-form { padding: 4px 10px; span { - font-size: 1.1em; color: $base-color; font-weight: 700; line-height: 2em; - - &.cw-default-block-invisible-info, - &.cw-default-block-blocker-warning { - font-weight: 400; - } - } - - img { - vertical-align: text-bottom; + font-size: 1.1em; } .cw-block-actions { @@ -933,12 +922,6 @@ form.cw-container-dialog-edit-form { } } -.cw-block-edit-warning { - font-style: italic; - color: $dark-gray-color; - margin: 1em 0 0.5em 0; -} - .cw-discuss-wrapper, .cw-block-features { @@ -3098,31 +3081,23 @@ a u d i o b l o c k padding-top: 106px; } } + .cw-audio-empty { + @include background-icon(file, info, 96); + border: solid thin $content-color-40; + background-position: center 1em; + background-repeat: no-repeat; + min-height: 140px; + padding: 1em; + p { + text-align: center; + padding-top: 106px; + } + } } /* * * * * * * * * * * * * * a u d i o b l o c k e n d * * * * * * * * * * * * * */ -/* * * * * * * * * * * * * * * * * * * * -f o r m u l t i m e d i a b l o c k s -* * * * * * * * * * * * * * * * * * * */ -.cw-file-empty { - @include background-icon(file, info, 96); - border: solid thin $content-color-40; - background-position: center 1em; - background-repeat: no-repeat; - min-height: 140px; - padding: 1em; - p { - text-align: center; - padding-top: 106px; - } -} - -/* * * * * * * * * * * * * * * * * * * * * * * * -f o r m u l t i m e d i a b l o c k s e n d -* * * * * * * * * * * * * * * * * * * * * * * */ - /* * * * * * * * * * v i d e o b l o c k * * * * * * * * * * */ diff --git a/resources/vue/components/courseware/CoursewareAccordionContainer.vue b/resources/vue/components/courseware/CoursewareAccordionContainer.vue index 924a92b0745..5f58dc46ee8 100755 --- a/resources/vue/components/courseware/CoursewareAccordionContainer.vue +++ b/resources/vue/components/courseware/CoursewareAccordionContainer.vue @@ -4,10 +4,9 @@ containerClass="cw-container-accordion" :canEdit="canEdit" :isTeacher="isTeacher" + @storeContainer="storeContainer" @closeEdit="initCurrentData" - @showEdit="setShowEdit" @sortBlocks="enableSort" - @storeContainer="storeContainer" > <template v-slot:containerContent> <courseware-collapsible-box @@ -115,7 +114,6 @@ export default { }, data() { return { - showEdit: false, currentContainer: {}, currentSections: [], sortMode: false, @@ -166,9 +164,6 @@ export default { this.currentSections = sections; }, - setShowEdit(state) { - this.showEdit = state; - }, addSection() { this.currentContainer.attributes.payload.sections.push({ name: '', icon: '', blocks: [] }); }, @@ -230,9 +225,7 @@ export default { }, watch: { blocks() { - if (!this.showEdit) { - this.initCurrentData(); - } + this.initCurrentData(); } } }; diff --git a/resources/vue/components/courseware/CoursewareActionWidget.vue b/resources/vue/components/courseware/CoursewareActionWidget.vue index 20df52240ec..572a94e6bc7 100644 --- a/resources/vue/components/courseware/CoursewareActionWidget.vue +++ b/resources/vue/components/courseware/CoursewareActionWidget.vue @@ -89,10 +89,10 @@ export default { return this.structuralElement?.id; }, blocked() { - return this.structuralElement?.relationships?.['edit-blocker']?.data !== null; + return this.structuralElement?.relationships['edit-blocker'].data !== null; }, blockerId() { - return this.blocked ? this.structuralElement?.relationships?.['edit-blocker']?.data?.id : null; + return this.blocked ? this.structuralElement?.relationships['edit-blocker'].data?.id : null; }, blockedByThisUser() { return this.blocked && this.userId === this.blockerId; diff --git a/resources/vue/components/courseware/CoursewareAudioBlock.vue b/resources/vue/components/courseware/CoursewareAudioBlock.vue index 6c4c733f1a5..a014faf5b69 100755 --- a/resources/vue/components/courseware/CoursewareAudioBlock.vue +++ b/resources/vue/components/courseware/CoursewareAudioBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle !== ''" class="cw-block-title">{{ currentTitle }}</div> @@ -60,7 +59,7 @@ </a> </li> </ul> - <div v-if="emptyAudio" class="cw-file-empty"> + <div v-if="emptyAudio" class="cw-audio-empty"> <p><translate>Es ist keine Audio-Datei verfügbar</translate></p> </div> <div v-if="showRecorder && canGetMediaDevices" class="cw-audio-playlist-recorder"> @@ -179,7 +178,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentSource: '', currentFileId: '', @@ -346,9 +344,6 @@ export default { this.currentFolderId = this.folderId; this.currentRecorderEnabled = this.recorderEnabled; }, - setShowEdit(state) { - this.showEdit = state; - }, updateCurrentFile(file) { this.currentFile = file; this.currentFileId = file.id; @@ -601,39 +596,6 @@ export default { currentFolderId() { this.getFolderFiles(); }, - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - source() { - if (!this.showEdit) { - this.currentSource = this.source; - } - }, - fileId() { - if (!this.showEdit) { - this.currentFileId = this.fileId; - if (this.currentFileId !== '') { - this.loadFile(); - } - } - }, - webUrl() { - if (!this.showEdit) { - this.currentWebUrl = this.webUrl; - } - }, - folderId() { - if (!this.showEdit) { - this.currentFolderId = this.folderId; - } - }, - recorderEnabled() { - if (!this.showEdit) { - this.currentRecorderEnabled = this.recorderEnabled; - } - }, }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareBeforeAfterBlock.vue b/resources/vue/components/courseware/CoursewareBeforeAfterBlock.vue index 95f4fb4c462..2c68473b9cd 100755 --- a/resources/vue/components/courseware/CoursewareBeforeAfterBlock.vue +++ b/resources/vue/components/courseware/CoursewareBeforeAfterBlock.vue @@ -5,12 +5,11 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> - <TwentyTwenty v-if="!isEmpty" :before="currentBeforeUrl" :after="currentAfterUrl" /> + <TwentyTwenty :before="currentBeforeUrl" :after="currentAfterUrl" /> </template> <template v-if="canEdit" #edit> <form class="default" @submit.prevent=""> @@ -80,7 +79,6 @@ export default { }, data() { return { - showEdit: false, currentBeforeSource: '', currentBeforeFileId: '', currentBeforeFile: {}, @@ -113,42 +111,40 @@ export default { return this.block?.attributes?.payload?.after_web_url; }, currentBeforeUrl() { - if (this.currentBeforeSource === 'studip' ) { - if (this.currentBeforeFile?.meta) { - return this.currentBeforeFile.meta['download-url']; - } - if (this.currentBeforeFile?.['download_url']) { - return this.currentBeforeFile['download_url'] - } - } - - if (this.currentBeforeSource === 'web') { + if (this.currentBeforeSource === 'studip'&& this.currentBeforeFile?.meta) { + return this.currentBeforeFile.meta['download-url']; + } else if (this.currentBeforeSource === 'web') { return this.currentBeforeWebUrl; + } else { + return ''; } - - return ''; }, currentAfterUrl() { - if (this.currentAfterSource === 'studip') { - if (this.currentAfterFile?.meta) { - return this.currentAfterFile.meta['download-url']; - } - if (this.currentAfterFile?.['download_url']) { - return this.currentAfterFile['download_url'] - } - } - if (this.currentAfterSource === 'web') { + if (this.currentAfterSource === 'studip'&& this.currentAfterFile?.meta) { + return this.currentAfterFile.meta['download-url']; + } else if (this.currentAfterSource === 'web') { return this.currentAfterWebUrl; + } else { + return ''; } - - return ''; }, - isEmpty() { - return !this.currentAfterUrl || !this.currentBeforeUrl; - } }, mounted() { - this.loadImages(); + this.loadFileRefs(this.block.id).then((response) => { + for (let i = 0; i < response.length; i++) { + if (response[i].id === this.beforeFileId) { + this.beforeFile = response[i]; + } + + if (response[i].id === this.afterFileId) { + this.afterFile = response[i]; + } + } + + this.currentBeforeFile = this.beforeFile; + this.currentAfterFile = this.afterFile; + }); + this.initCurrentData(); }, methods: { @@ -157,22 +153,6 @@ export default { loadFileRefs: 'loadFileRefs', companionWarning: 'companionWarning', }), - loadImages() { - this.loadFileRefs(this.block.id).then((response) => { - for (let i = 0; i < response.length; i++) { - if (response[i].id === this.beforeFileId) { - this.beforeFile = response[i]; - } - - if (response[i].id === this.afterFileId) { - this.afterFile = response[i]; - } - } - - this.currentBeforeFile = this.beforeFile; - this.currentAfterFile = this.afterFile; - }); - }, initCurrentData() { this.currentBeforeSource = this.beforeSource; this.currentBeforeFileId = this.beforeFileId; @@ -181,9 +161,6 @@ export default { this.currentAfterFileId = this.afterFileId; this.currentAfterWebUrl = this.afterWebUrl; }, - setShowEdit(state) { - this.showEdit = state; - }, updateCurrentBeforeFile(file) { this.currentBeforeFile = file; this.currentBeforeFileId = file.id; @@ -250,39 +227,5 @@ export default { } }, }, - watch: { - beforeSource() { - if (!this.showEdit) { - this.currentBeforeSource = this.beforeSource; - } - }, - beforeFileId() { - if (!this.showEdit) { - this.currentBeforeFileId = this.beforeFileId; - this.loadImages(); - } - }, - beforeWebUrl() { - if (!this.showEdit) { - this.currentBeforeWebUrl = this.beforeWebUrl; - } - }, - afterSource() { - if (!this.showEdit) { - this.currentAfterSource = this.afterSource; - } - }, - afterFileId() { - if (!this.showEdit) { - this.currentAfterFileId = this.afterFileId; - this.loadImages(); - } - }, - afterWebUrl() { - if (!this.showEdit) { - this.currentAfterWebUrl = this.afterWebUrl; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareBlockActions.vue b/resources/vue/components/courseware/CoursewareBlockActions.vue index 3019e40196d..2948369385e 100755 --- a/resources/vue/components/courseware/CoursewareBlockActions.vue +++ b/resources/vue/components/courseware/CoursewareBlockActions.vue @@ -2,13 +2,11 @@ <div class="cw-block-actions"> <studip-action-menu :items="menuItems" - collapseAt="2" :context="block.attributes.title" @editBlock="editBlock" @setVisibility="setVisibility" @showInfo="showInfo" @deleteBlock="deleteBlock" - @removeLock="removeLock" /> </div> </template> @@ -30,68 +28,57 @@ export default { }, block: Object, }, + data() { + return { + menuItems: [], + }; + }, computed: { ...mapGetters({ userId: 'userId', - userIsTeacher: 'userIsTeacher', }), blocked() { - return this.block?.relationships?.['edit-blocker']?.data !== null; + return this.block?.relationships['edit-blocker'].data !== null; }, blockerId() { - return this.blocked ? this.block?.relationships?.['edit-blocker']?.data?.id : null; - }, - blockedByThisUser() { - return this.blocked && this.userId === this.blockerId; - }, - blockedByAnotherUser() { - return this.blocked && this.userId !== this.blockerId; + return this.blocked ? this.block?.relationships['edit-blocker'].data?.id : null; }, - menuItems() { - let menuItems = []; - if (this.canEdit) { - if (!this.deleteOnly) { - if (!this.blocked) { - menuItems.push({ id: 1, label: this.$gettext('Block bearbeiten'), icon: 'edit', emit: 'editBlock' }); - menuItems.push({ - id: 2, - label: this.block.attributes.visible - ? this.$gettext('unsichtbar setzen') - : this.$gettext('sichtbar setzen'), - icon: this.block.attributes.visible ? 'visibility-visible' : 'visibility-invisible', // do we change the icons ? - emit: 'setVisibility', - }); - } - if (this.blocked && this.blockedByAnotherUser && this.userIsTeacher) { - menuItems.push({ - id: 8, - label: this.$gettext('Sperre aufheben'), - icon: 'lock-unlocked', - emit: 'removeLock', - }); - } - if (!this.blocked || this.blockedByThisUser) { - menuItems.push({ - id: 9, - label: this.$gettext('Block löschen'), - icon: 'trash', - emit: 'deleteBlock' - }); - } - menuItems.push({ - id: 7, - label: this.$gettext('Informationen zum Block'), - icon: 'info', - emit: 'showInfo', - }); - } + }, + mounted() { + if (this.canEdit) { + if (!this.deleteOnly) { + this.menuItems.push({ + id: 1, + label: this.$gettext('Block bearbeiten'), + icon: 'edit', + emit: 'editBlock', + }); + this.menuItems.push({ + id: 2, + label: this.block.attributes.visible + ? this.$gettext('unsichtbar setzen') + : this.$gettext('sichtbar setzen'), + icon: this.block.attributes.visible ? 'visibility-visible' : 'visibility-invisible', // do we change the icons ? + emit: 'setVisibility', + }); + this.menuItems.push({ + id: 7, + label: this.$gettext('Informationen zum Block'), + icon: 'info', + emit: 'showInfo', + }); } - - menuItems.sort((a, b) => { - return a.id > b.id ? 1 : b.id > a.id ? -1 : 0; + this.menuItems.push({ + id: 9, + label: this.$gettext('Block löschen'), + icon: 'trash', + emit: 'deleteBlock', }); - return menuItems; } + + this.menuItems.sort((a, b) => { + return a.id > b.id ? 1 : b.id > a.id ? -1 : 0; + }); }, methods: { ...mapActions({ @@ -130,12 +117,12 @@ export default { await this.unlockObject({ id: this.block.id, type: 'courseware-blocks' }); }, + copyToClipboard() { + // use JSONAPI to copy to clipboard + }, deleteBlock() { this.$emit('deleteBlock'); }, - removeLock() { - this.$emit('removeLock'); - } }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareCanvasBlock.vue b/resources/vue/components/courseware/CoursewareCanvasBlock.vue index f0d495f4151..8b829b365d5 100755 --- a/resources/vue/components/courseware/CoursewareCanvasBlock.vue +++ b/resources/vue/components/courseware/CoursewareCanvasBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle" class="cw-block-title"> @@ -165,7 +164,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentImage: '', currentFileId: '', @@ -257,7 +255,12 @@ export default { }, }, mounted() { - this.loadImageFile(); + this.loadFileRefs(this.block.id).then((response) => { + this.file = response[0]; + this.currentFile = this.file; + this.initCurrentData(); + this.buildCanvas(); + }); }, methods: { ...mapActions({ @@ -283,17 +286,6 @@ export default { this.Text = JSON.parse(this.canvasDraw.Text); } }, - setShowEdit(state) { - this.showEdit = state; - }, - loadImageFile() { - this.loadFileRefs(this.block.id).then((response) => { - this.file = response[0]; - this.currentFile = this.file; - this.initCurrentData(); - this.buildCanvas(); - }); - }, updateCurrentFile(file) { this.currentFile = file; this.currentFileId = file.id; @@ -604,34 +596,5 @@ export default { } }, }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - image() { - if (!this.showEdit) { - this.currentImage = this.image; - this.buildCanvas(); - } - }, - fileId() { - if (!this.showEdit) { - this.currentFileId = this.fileId; - this.loadImageFile(); - } - }, - uploadFolderId() { - if (!this.showEdit) { - this.currentUploadFolderId = this.uploadFolderId; - } - }, - showUsersData() { - if (!this.showEdit) { - this.currentShowUserData = this.showUsersData; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareChartBlock.vue b/resources/vue/components/courseware/CoursewareChartBlock.vue index 0c5de9719be..8dd58ec2433 100755 --- a/resources/vue/components/courseware/CoursewareChartBlock.vue +++ b/resources/vue/components/courseware/CoursewareChartBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <canvas class="cw-chart-block-canvas" ref="chartCanvas" /> @@ -88,11 +87,9 @@ import CoursewareDefaultBlock from './CoursewareDefaultBlock.vue'; import Chart from 'chart.js'; import { mapActions } from 'vuex'; import StudipIcon from '../StudipIcon.vue'; -import { blockMixin } from './block-mixin.js'; export default { name: 'courseware-chart-block', - mixins: [blockMixin], components: { CoursewareDefaultBlock, StudipIcon, @@ -104,7 +101,6 @@ export default { }, data() { return { - showEdit: false, chart: null, currentContent: [], currentLabel: '', @@ -150,9 +146,6 @@ export default { this.currentLabel = this.label; this.currentType = this.type; }, - setShowEdit(state) { - this.showEdit = state; - }, storeBlock() { let attributes = {}; attributes.payload = {}; @@ -288,29 +281,12 @@ export default { }); break; } - } + }, }, watch: { currentType() { this.buildChart(); }, - content() { - if (!this.showEdit && !this.contentsEqual(this.currentContent,this.content)) { - this.currentContent = this.content; - this.buildChart(); - } - }, - label() { - if (!this.showEdit) { - this.currentLabel = this.label; - this.buildChart(); - } - }, - type() { - if (!this.showEdit) { - this.currentType = this.type; - } - }, }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareCodeBlock.vue b/resources/vue/components/courseware/CoursewareCodeBlock.vue index c5492452a63..275a77f5e87 100755 --- a/resources/vue/components/courseware/CoursewareCodeBlock.vue +++ b/resources/vue/components/courseware/CoursewareCodeBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <pre v-show="currentContent !== ''" v-highlightjs="currentContent"><code ref="code" :class="[currentLang]"></code></pre> @@ -52,7 +51,6 @@ export default { }, data() { return { - showEdit: false, currentLang: '', currentContent: '', }; @@ -99,9 +97,6 @@ export default { this.currentLang = this.lang; this.currentContent = this.content; }, - setShowEdit(state) { - this.showEdit = state; - }, storeBlock() { let attributes = {}; attributes.payload = {}; @@ -115,17 +110,5 @@ export default { }); }, }, - watch: { - lang() { - if (!this.showEdit) { - this.currentLang = this.lang; - } - }, - content() { - if (!this.showEdit) { - this.currentContent = this.content; - } - } - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareConfirmBlock.vue b/resources/vue/components/courseware/CoursewareConfirmBlock.vue index e420bda4820..4e602f82e1f 100755 --- a/resources/vue/components/courseware/CoursewareConfirmBlock.vue +++ b/resources/vue/components/courseware/CoursewareConfirmBlock.vue @@ -6,9 +6,8 @@ :isTeacher="isTeacher" :preview="true" :defaultGrade="false" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div class="cw-block-title"> @@ -57,7 +56,6 @@ export default { }, data() { return { - showEdit: false, currentText: '', confirm: false, }; @@ -87,9 +85,6 @@ export default { this.confirm = this.userData.attributes.payload.confirm; } }, - setShowEdit(state) { - this.showEdit = state; - }, async setConfirm() { let data = {}; data.type = 'courseware-user-data-fields'; @@ -119,12 +114,5 @@ export default { }); }, }, - watch: { - text() { - if (!this.showEdit) { - this.currentText = this.text; - } - } - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareContainerActions.vue b/resources/vue/components/courseware/CoursewareContainerActions.vue index d30347d776a..40e618e24e2 100755 --- a/resources/vue/components/courseware/CoursewareContainerActions.vue +++ b/resources/vue/components/courseware/CoursewareContainerActions.vue @@ -6,14 +6,11 @@ @editContainer="editContainer" @deleteContainer="deleteContainer" @sortBlocks="sortBlocks" - @removeLock="removeLock" /> </div> </template> <script> -import { mapGetters } from 'vuex'; - export default { name: 'courseware-container-actions', props: { @@ -21,45 +18,19 @@ export default { container: Object, }, computed: { - ...mapGetters({ - userId: 'userId', - userIsTeacher: 'userIsTeacher', - }), - blocked() { - return this.container?.relationships?.['edit-blocker']?.data !== null; - }, - blockerId() { - return this.blocked ? this.container?.relationships?.['edit-blocker']?.data?.id : null; - }, - blockedByThisUser() { - return this.blocked && this.userId === this.blockerId; - }, - blockedByAnotherUser() { - return this.blocked && this.userId !== this.blockerId; - }, menuItems() { - let menuItems = []; - if (!this.blockedByAnotherUser) { - if (this.container.attributes["container-type"] !== 'list') { - menuItems.push({ id: 1, label: this.$gettext('Abschnitt bearbeiten'), icon: 'edit', emit: 'editContainer' }); - } - menuItems.push({ id: 2, label: this.$gettext('Blöcke sortieren'), icon: 'arr_1sort', emit: 'sortBlocks' }); - menuItems.push({ id: 3, label: this.$gettext('Abschnitt löschen'), icon: 'trash', emit: 'deleteContainer' }); + if (this.container.attributes["container-type"] === 'list') { + return [ + { id: 1, label: this.$gettext('Blöcke sortieren'), icon: 'arr_1sort', emit: 'sortBlocks' }, + { id: 2, label: this.$gettext('Abschnitt löschen'), icon: 'trash', emit: 'deleteContainer' } + ]; + } else { + return [ + { id: 1, label: this.$gettext('Abschnitt bearbeiten'), icon: 'edit', emit: 'editContainer' }, + { id: 2, label: this.$gettext('Blöcke sortieren'), icon: 'arr_1sort', emit: 'sortBlocks' }, + { id: 3, label: this.$gettext('Abschnitt löschen'), icon: 'trash', emit: 'deleteContainer' }, + ]; } - - if (this.blocked && this.blockedByAnotherUser && this.userIsTeacher) { - menuItems.push({ - id: 4, - label: this.$gettext('Sperre aufheben'), - icon: 'lock-unlocked', - emit: 'removeLock', - }); - } - - menuItems.sort((a, b) => { - return a.id > b.id ? 1 : b.id > a.id ? -1 : 0; - }); - return menuItems; }, }, methods: { @@ -74,9 +45,6 @@ export default { }, sortBlocks() { this.$emit('sortBlocks'); - }, - removeLock() { - this.$emit('removeLock'); } }, }; diff --git a/resources/vue/components/courseware/CoursewareDateBlock.vue b/resources/vue/components/courseware/CoursewareDateBlock.vue index 49a1aea523c..da119891f81 100755 --- a/resources/vue/components/courseware/CoursewareDateBlock.vue +++ b/resources/vue/components/courseware/CoursewareDateBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentStyle === 'countdown'" class="cw-date-countdown"> @@ -70,7 +69,7 @@ </label> <label> <translate>Layout</translate> - <select v-model="currentStyle" @change="computeTimestamp"> + <select v-model="currentStyle"> <option value="countdown"><translate>Countdown</translate></option> <option value="date"><translate>Datum</translate></option> </select> @@ -98,7 +97,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentTimestamp: 0, currentStyle: '', @@ -140,29 +138,20 @@ export default { initCurrentData() { this.currentTitle = this.title; this.currentTimestamp = this.timestamp; - this.setCurrentDate(); - this.setCurrentDeDate(); - this.currentTime = ('0' + this.date.getHours()).slice(-2) + ':' + ('0' + this.date.getMinutes()).slice(-2); - this.currentStyle = this.style; - }, - setCurrentDate() { this.currentDate = this.date.getFullYear() + '-' + ('0' + (this.date.getMonth() + 1)).slice(-2) + '-' + ('0' + this.date.getDate()).slice(-2); - }, - setCurrentDeDate() { this.currentDeDate = ('0' + this.date.getDate()).slice(-2) + '.' + ('0' + (this.date.getMonth() + 1)).slice(-2) + '.' + this.date.getFullYear(); - }, - setShowEdit(state) { - this.showEdit = state; + this.currentTime = ('0' + this.date.getHours()).slice(-2) + ':' + ('0' + this.date.getMinutes()).slice(-2); + this.currentStyle = this.style; }, countdown() { let view = this; @@ -182,11 +171,6 @@ export default { }, computeTimestamp() { this.currentTimestamp = new Date(this.currentDate + ' ' + this.currentTime).getTime(); - this.setCurrentDate(); - this.setCurrentDeDate(); - if (this.currentStyle === 'countdown') { - this.countdown(); - } }, storeBlock() { let cmpInfo = false; @@ -212,24 +196,9 @@ export default { containerId: this.block.relationships.container.data.id, }); } + + }, }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - timestamp() { - if (!this.showEdit) { - this.initCurrentData(); - } - }, - style() { - if (!this.showEdit) { - this.currentStyle = this.style; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareDefaultBlock.vue b/resources/vue/components/courseware/CoursewareDefaultBlock.vue index 85e97b5e862..6390265626d 100755 --- a/resources/vue/components/courseware/CoursewareDefaultBlock.vue +++ b/resources/vue/components/courseware/CoursewareDefaultBlock.vue @@ -3,14 +3,12 @@ <div class="cw-content-wrapper" :class="[showEditMode ? 'cw-content-wrapper-active' : '']"> <header v-if="showEditMode" class="cw-block-header"> <span class="cw-sortable-handle"></span> - <studip-icon v-if="!block.attributes.visible" shape="visibility-invisible" /> - <studip-icon v-if="blockedByAnotherUser" shape="lock-locked" /> - <span>{{ blockTitle }}</span> - <span v-if="blockedByAnotherUser" class="cw-default-block-blocker-warning"> - | {{ $gettextInterpolate('wird im Moment von %{ userName } bearbeitet', { userName: this.blockingUserName }) }} + <span v-if="!block.attributes.visible" class="cw-default-block-invisible-info"> + <studip-icon shape="visibility-invisible" /> </span> + <span>{{ blockTitle }}</span> <span v-if="!block.attributes.visible" class="cw-default-block-invisible-info"> - | {{ $gettext('unsichtbar für Nutzende ohne Schreibrecht') }} + (<translate>unsichtbar für Nutzende ohne Schreibrecht</translate>) </span> <courseware-block-actions :block="block" @@ -20,7 +18,6 @@ @showInfo="displayFeature('Info')" @showExportOptions="displayFeature('ExportOptions')" @deleteBlock="displayDeleteDialog()" - @removeLock="displayRemoveLockDialog()" /> </header> <div v-if="showContent" class="cw-block-content"> @@ -64,15 +61,6 @@ @confirm="executeDelete" @close="showDeleteDialog = false" ></studip-dialog> - <studip-dialog - v-if="showRemoveLockDialog" - :title="textRemoveLockTitle" - :question="textRemoveLockAlert" - height="200" - width="450" - @confirm="executeRemoveLock" - @close="showRemoveLockDialog = false" - ></studip-dialog> </div> </template> @@ -130,12 +118,9 @@ export default { showContent: true, showEditModeShortcut: false, showDeleteDialog: false, - showRemoveLockDialog: false, currentComments: [], textDeleteTitle: this.$gettext('Block unwiderruflich löschen'), textDeleteAlert: this.$gettext('Möchten Sie diesen Block wirklich löschen?'), - textRemoveLockTitle: this.$gettext('Sperre aufheben'), - textRemoveLockAlert: this.$gettext('Möchten Sie die Sperre dieses Block wirklich aufheben? Der Bearbeitungsstand geht dabei unwiderruflich verloren.'), }; }, computed: { @@ -144,7 +129,6 @@ export default { containerById: 'courseware-containers/byId', context: 'context', userId: 'userId', - userById: 'users/byId', viewMode: 'viewMode', }), showEditMode() { @@ -158,10 +142,10 @@ export default { return this.viewMode === 'discuss'; }, blocked() { - return this.block?.relationships?.['edit-blocker']?.data !== null; + return this.block?.relationships['edit-blocker'].data !== null; }, blockerId() { - return this.blocked ? this.block?.relationships?.['edit-blocker']?.data?.id : null; + return this.blocked ? this.block?.relationships['edit-blocker'].data?.id : null; }, blockedByThisUser() { return this.blocked && this.userId === this.blockerId; @@ -169,20 +153,6 @@ export default { blockedByAnotherUser() { return this.blocked && this.userId !== this.blockerId; }, - blockingUser() { - if (this.blockedByAnotherUser) { - const user = this.$store.getters["users/related"]({ - parent: { type: this.block.type, id: this.block.id }, - relationship: "edit-blocker" - }); - return user ? user : null; - } - - return null; - }, - blockingUserName() { - return this.blockingUser ? this.blockingUser.attributes['formatted-name'] : ''; - }, blockTitle() { const type = this.block.attributes['block-type']; @@ -197,9 +167,6 @@ export default { if (this.blockedByThisUser) { this.displayFeature('Edit'); } - if (this.blockedByAnotherUser) { - this.loadUserById({ id: this.blockerId }); - } } if (!this.public && this.userProgress && this.userProgress.attributes.grade === 0 && this.defaultGrade) { this.userProgress = 1; @@ -213,7 +180,6 @@ export default { unlockObject: 'unlockObject', loadContainer: 'loadContainer', updateContainer: 'updateContainer', - loadUserById: 'users/loadById' }), async displayFeature(element) { if (this.showEdit && element === 'Edit') { @@ -311,18 +277,6 @@ export default { containerId: containerId, }); }, - displayRemoveLockDialog() { - this.showRemoveLockDialog = true; - }, - executeRemoveLock() { - this.unlockObject({ id: this.block.id , type: 'courseware-blocks' }); - this.showRemoveLockDialog = false; - } }, - watch: { - showEdit(state) { - this.$emit('showEdit', state); - } - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareDefaultContainer.vue b/resources/vue/components/courseware/CoursewareDefaultContainer.vue index 774cc7f46a0..a24e9a8bd51 100755 --- a/resources/vue/components/courseware/CoursewareDefaultContainer.vue +++ b/resources/vue/components/courseware/CoursewareDefaultContainer.vue @@ -5,18 +5,13 @@ > <div class="cw-container-content"> <header v-if="showEditMode && canEdit" class="cw-container-header"> - <studip-icon v-if="blockedByAnotherUser" shape="lock-locked" /> <span>{{ container.attributes.title }} ({{container.attributes.width}})</span> - <span v-if="blockedByAnotherUser" class="cw-default-container-blocker-warning"> - | {{ $gettextInterpolate('wird im Moment von %{ userName } bearbeitet', { userName: this.blockingUserName }) }} - </span> <courseware-container-actions :canEdit="canEdit" :container="container" @editContainer="displayEditDialog" @deleteContainer="displayDeleteDialog" @sortBlocks="sortBlocks" - @removeLock="displayRemoveLockDialog()" /> </header> <div class="cw-block-wrapper" :class="{ 'cw-block-wrapper-active': showEditMode }"> @@ -49,16 +44,6 @@ @confirm="executeDelete" @close="closeDeleteDialog" ></studip-dialog> - - <studip-dialog - v-if="showRemoveLockDialog" - :title="textRemoveLockTitle" - :question="textRemoveLockAlert" - height="200" - width="450" - @confirm="executeRemoveLock" - @close="showRemoveLockDialog = false" - ></studip-dialog> </div> </div> </template> @@ -84,14 +69,11 @@ export default { return { showDeleteDialog: false, showEditDialog: false, - showRemoveLockDialog: false, textEditConfirm: this.$gettext('Speichern'), textEditClose: this.$gettext('Schließen'), textEditTitle: this.$gettext('Abschnitt bearbeiten'), textDeleteTitle: this.$gettext('Abschnitt unwiderruflich löschen'), textDeleteAlert: this.$gettext('Möchten Sie diesen Abschnitt wirklich löschen?'), - textRemoveLockTitle: this.$gettext('Sperre aufheben'), - textRemoveLockAlert: this.$gettext('Möchten Sie die Sperre dieses Block wirklich aufheben? Der Bearbeitungsstand geht dabei unwiderruflich verloren.'), }; }, computed: { @@ -105,10 +87,10 @@ export default { return this.container.attributes.payload.colspan ? this.container.attributes.payload.colspan : 'full'; }, blocked() { - return this.container?.relationships?.['edit-blocker']?.data !== null; + return this.container?.relationships['edit-blocker'].data !== null; }, blockerId() { - return this.blocked ? this.container?.relationships?.['edit-blocker']?.data?.id : null; + return this.blocked ? this.container?.relationships['edit-blocker'].data?.id : null; }, blockedByThisUser() { return this.blocked && this.userId === this.blockerId; @@ -116,20 +98,6 @@ export default { blockedByAnotherUser() { return this.blocked && this.userId !== this.blockerId; }, - blockingUser() { - if (this.blockedByAnotherUser) { - const user = this.$store.getters["users/related"]({ - parent: { type: this.container.type, id: this.container.id }, - relationship: "edit-blocker" - }); - return user ? user : null; - } - - return null; - }, - blockingUserName() { - return this.blockingUser ? this.blockingUser.attributes['formatted-name'] : ''; - }, }, methods: { ...mapActions({ @@ -204,25 +172,7 @@ export default { return false; } this.$emit('sortBlocks'); - }, - displayRemoveLockDialog() { - this.showRemoveLockDialog = true; - }, - executeRemoveLock() { - this.unlockObject({ id: this.container.id , type: 'courseware-containers' }); - this.showRemoveLockDialog = false; - }, - }, - watch: { - showEditDialog(state) { - this.$emit('showEdit', state); - }, - blockedByThisUser(newState, oldState) { - if (oldState && !newState) { - this.showDeleteDialog = false; - this.showEditDialog = false; - } } - } + }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareDialogCardsBlock.vue b/resources/vue/components/courseware/CoursewareDialogCardsBlock.vue index ad695dabe3b..a8173c7d193 100755 --- a/resources/vue/components/courseware/CoursewareDialogCardsBlock.vue +++ b/resources/vue/components/courseware/CoursewareDialogCardsBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div class="cw-block-dialog-cards-content"> @@ -136,7 +135,6 @@ export default { }, data() { return { - showEdit: false, currentCards: [], setCardTab: 0 }; @@ -172,13 +170,10 @@ export default { }), initCurrentData() { if (this.cards !== '') { - this.currentCards = this.cards; + this.currentCards = JSON.parse(JSON.stringify(this.cards)); } this.setCardTab = 0; }, - setShowEdit(state) { - this.showEdit = state; - }, storeBlock() { let cards = JSON.parse(JSON.stringify(this.currentCards)); // don't store the file object @@ -270,21 +265,6 @@ export default { } }); }, - cardsEqual(a1, a2) { - return a1.length === a2.length && a1.every((o, idx) => { - return o.back_file_id === a2[idx].back_file_id && - o.back_text === a2[idx].back_text && - o.front_file_id === a2[idx].front_file_id && - o.front_text === a2[idx].front_text; - }); - } - }, - watch: { - cards() { - if (!this.showEdit && !this.cardsEqual(this.currentCards, this.cards)) { - this.initCurrentData(); - } - }, }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareDocumentBlock.vue b/resources/vue/components/courseware/CoursewareDocumentBlock.vue index f2d243dd3a4..134e167ca45 100755 --- a/resources/vue/components/courseware/CoursewareDocumentBlock.vue +++ b/resources/vue/components/courseware/CoursewareDocumentBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="false" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="hasFile" class="cw-pdf-header cw-block-title"> @@ -88,7 +87,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentFileId: '', currentFile: {}, @@ -125,16 +123,29 @@ export default { currentUrl() { if (this.currentFile?.meta) { return this.currentFile.meta['download-url']; + } else { + return ''; } - if (this.currentFile?.['download_url']) { - return this.currentFile['download_url']; - } - return ''; }, hasFile() { return this.currentFileId !== ''; } }, + watch: { + browseDirection: function (val) { + if (val.length > 6) { + this.evaluateBrowseAction(); + } + }, + }, + mounted() { + this.loadFileRefs(this.block.id).then((response) => { + this.file = response[0]; + this.currentFile = this.file; + this.loadPdfViewer(); + }); + this.initCurrentData(); + }, methods: { ...mapActions({ updateBlock: 'updateBlockInContainer', @@ -147,9 +158,6 @@ export default { this.currentFileId = this.fileId; this.currentDocType = this.docType; }, - setShowEdit(state) { - this.showEdit = state; - }, updateCurrentFile(file) { this.currentFile = file; this.currentFileId = file.id; @@ -248,44 +256,7 @@ export default { containerId: this.block.relationships.container.data.id, }); } - }, - loadDocument() { - this.loadFileRefs(this.block.id).then((response) => { - this.file = response[0]; - this.currentFile = this.file; - this.loadPdfViewer(); - }); - } - }, - mounted() { - this.loadDocument(); - this.initCurrentData(); - }, - watch: { - browseDirection: function (val) { - if (val.length > 6) { - this.evaluateBrowseAction(); - } - }, - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - downloadable() { - if (!this.showEdit) { - this.currentDownloadable = this.downloadable; - } - }, - fileId() { - if (!this.showEdit) { - this.currentFileId = this.fileId; - } - }, - title() { - if (!this.showEdit) { - this.currentDocType = this.docType; - } + }, }, }; diff --git a/resources/vue/components/courseware/CoursewareDownloadBlock.vue b/resources/vue/components/courseware/CoursewareDownloadBlock.vue index c9ad453e235..2094cfa7133 100755 --- a/resources/vue/components/courseware/CoursewareDownloadBlock.vue +++ b/resources/vue/components/courseware/CoursewareDownloadBlock.vue @@ -6,9 +6,8 @@ :isTeacher="isTeacher" :preview="true" :defaultGrade="false" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle !== ''" class="cw-block-title">{{ currentTitle }}</div> @@ -89,7 +88,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentInfo: '', currentSuccess: '', @@ -154,9 +152,6 @@ export default { this.loadFile(); } }, - setShowEdit(state) { - this.showEdit = state; - }, async loadFile() { const id = `${this.currentFileId}`; const options = { include: 'terms-of-use' }; @@ -263,35 +258,5 @@ export default { this.userProgress = 1; }, }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - info() { - if (!this.showEdit) { - this.currentInfo = this.info; - } - }, - fileId() { - if (!this.showEdit) { - this.currentFileId = this.fileId; - if (this.currentFileId !== '') { - this.loadFile(); - } - } - }, - success() { - if (!this.showEdit) { - this.currentSuccess = this.success; - } - }, - grade() { - if (!this.showEdit) { - this.currentGrade = this.grade; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareEmbedBlock.vue b/resources/vue/components/courseware/CoursewareEmbedBlock.vue index 80795bc72ef..2808ffa2478 100755 --- a/resources/vue/components/courseware/CoursewareEmbedBlock.vue +++ b/resources/vue/components/courseware/CoursewareEmbedBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="false" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle !== ''" class="cw-block-title">{{ currentTitle }}</div> @@ -27,7 +26,7 @@ <img :src="oembedData.fullsize_url" /> </div> </div> - <div class="cw-block-embed-info" v-if="oembedData"> + <div class="cw-block-embed-info" v-if="oembedData !== null"> <span class="cw-block-embed-title">{{ oembedData.title }}</span> <span class="cw-block-embed-author-name"> <translate>erstellt von</translate> @@ -103,7 +102,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentSource: '', currentUrl: '', @@ -178,9 +176,6 @@ export default { this.updateTime(); } }, - setShowEdit(state) { - this.showEdit = state; - }, addTimeData(data) { if (this.currentSource === 'youtube') { if (this.currentStartTime !== '') { @@ -235,41 +230,5 @@ export default { }); }, }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - source() { - if (!this.showEdit) { - this.currentSource = this.source; - } - }, - url() { - if (!this.showEdit) { - this.currentUrl = this.url; - } - }, - startTime() { - if (!this.showEdit) { - this.currentStartTime = this.startTime; - } - }, - endTime() { - if (!this.showEdit) { - this.currentEndTime = this.endTime; - } - }, - oembed() { - if (!this.showEdit) { - this.oembedData = this.oembed; - if (this.oembedData !== null) { - this.calcContentHeight(); - this.updateTime(); - } - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareEmptyElementBox.vue b/resources/vue/components/courseware/CoursewareEmptyElementBox.vue index 8e1ab2fc6d3..b64413d26c8 100755 --- a/resources/vue/components/courseware/CoursewareEmptyElementBox.vue +++ b/resources/vue/components/courseware/CoursewareEmptyElementBox.vue @@ -2,8 +2,8 @@ <div class="cw-wellcome-screen"> <courseware-companion-box :msgCompanion="this.$gettext('Es wurden bisher noch keine Inhalte eingepflegt.')"> <template v-slot:companionActions> - <button v-show="canEdit && noContainers" class="button" @click="addContainer"><translate>Einen Abschnitt hinzufügen</translate></button> - <button v-show="canEdit && !noContainers && !editMode" class="button" @click="switchToEditView"><translate>Seite bearbeiten</translate></button> + <button v-if="canEdit && noContainers" class="button" @click="addContainer"><translate>Einen Abschnitt hinzufügen</translate></button> + <button v-if="canEdit && !noContainers && !editMode" class="button" @click="switchToEditView"><translate>Seite bearbeiten</translate></button> </template> </courseware-companion-box> </div> @@ -48,4 +48,4 @@ export default { } } -</script> +</script> \ No newline at end of file diff --git a/resources/vue/components/courseware/CoursewareFolderBlock.vue b/resources/vue/components/courseware/CoursewareFolderBlock.vue index 7f7276d4425..a1b97490d09 100755 --- a/resources/vue/components/courseware/CoursewareFolderBlock.vue +++ b/resources/vue/components/courseware/CoursewareFolderBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle !== ''" class="cw-block-title">{{ currentTitle }}</div> @@ -65,7 +64,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentFolderId: '', currentFileType: '', @@ -101,21 +99,13 @@ export default { this.currentFolderId = this.folderId; this.currentFolderType = this.folderType; }, - setShowEdit(state) { - this.showEdit = state; - }, async getFolderFiles() { - if (this.currentFolderId) { - const parent = { type: 'folders', id: `${this.currentFolderId}` }; - const relationship = 'file-refs'; - const options = { include: 'terms-of-use' }; - await this.loadRelatedFileRefs({ parent, relationship, options }); - const fileRefs = this.relatedFileRefs({ parent, relationship }) ?? []; - this.processFiles(fileRefs); - } else { - this.files = []; - } - + const parent = { type: 'folders', id: `${this.currentFolderId}` }; + const relationship = 'file-refs'; + const options = { include: 'terms-of-use' }; + await this.loadRelatedFileRefs({ parent, relationship, options }); + const fileRefs = this.relatedFileRefs({ parent, relationship }) ?? []; + this.processFiles(fileRefs); }, processFiles(files) { this.files = files @@ -199,21 +189,6 @@ export default { currentFolderId() { this.getFolderFiles(); }, - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - folderId() { - if (!this.showEdit) { - this.currentFolderId = this.folderId; - } - }, - folderType() { - if (!this.showEdit) { - this.currentFolderType = this.folderType; - } - }, }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareGalleryBlock.vue b/resources/vue/components/courseware/CoursewareGalleryBlock.vue index 1066e53b32d..9d0549b25c9 100755 --- a/resources/vue/components/courseware/CoursewareGalleryBlock.vue +++ b/resources/vue/components/courseware/CoursewareGalleryBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="files.length !== 0" class="cw-block-gallery-content" :style="{ 'max-height': currentHeight + 'px' }"> @@ -100,7 +99,6 @@ export default { }, data() { return { - showEdit: false, currentFolderId: '', currentAutoplay: '', currentNav: '', @@ -152,9 +150,6 @@ export default { this.currentHeight = this.height; this.currentShowFileNames = this.showFileNames; }, - setShowEdit(state) { - this.showEdit = state; - }, startGallery() { this.slideIndex = 0; this.showSlides(0); @@ -259,38 +254,6 @@ export default { this.currentAutoplayTimer = '2'; } }, - folderId() { - if (!this.showEdit) { - this.currentFolderId = this.folderId; - } - }, - autoplay() { - if (!this.showEdit) { - this.currentAutoplay = this.autoplay; - this.startGallery(); - } - }, - autoplayTimer() { - if (!this.showEdit) { - this.currentAutoplayTimer = this.autoplayTimer; - this.startGallery(); - } - }, - nav() { - if (!this.showEdit) { - this.currentNav = this.nav; - } - }, - height() { - if (!this.showEdit) { - this.currentHeight = this.height; - } - }, - showFileNames() { - if (!this.showEdit) { - this.currentShowFileNames = this.showFileNames; - } - }, }, }; </script> diff --git a/resources/vue/components/courseware/CoursewareHeadlineBlock.vue b/resources/vue/components/courseware/CoursewareHeadlineBlock.vue index ae95b4061da..9cc3e5557fc 100755 --- a/resources/vue/components/courseware/CoursewareHeadlineBlock.vue +++ b/resources/vue/components/courseware/CoursewareHeadlineBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" - @storeEdit="storeBlock" + @storeEdit="storeText" + @closeEdit="closeEdit" > <template #content> <div @@ -183,7 +182,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentSubtitle: '', currentStyle: '', @@ -322,9 +320,6 @@ export default { this.loadFile(); } }, - setShowEdit(state) { - this.showEdit = state; - }, async loadFile() { const id = this.currentBackgroundImageId; const options = { include: 'terms-of-use' }; @@ -347,7 +342,10 @@ export default { this.currentBackgroundImageId = file.id; this.currentBackgroundURL = file.download_url; }, - storeBlock() { + closeEdit() { + this.initCurrentData(); + }, + storeText() { let attributes = {}; attributes.payload = {}; attributes.payload.title = this.currentTitle; @@ -409,60 +407,5 @@ export default { return hex.length === 1 ? '0' + hex : hex; }, }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - subtitle() { - if (!this.showEdit) { - this.currentSubtitle = this.subtitle; - } - }, - style() { - if (!this.showEdit) { - this.currentStyle = this.style; - } - }, - height() { - if (!this.showEdit) { - this.currentHeight = this.height; - } - }, - backgroundColor() { - if (!this.showEdit) { - this.currentBackgroundColor = this.backgroundColor; - } - }, - textColor() { - if (!this.showEdit) { - this.currentTextColor = this.textColor; - } - }, - icon() { - if (!this.showEdit) { - this.currentIcon = this.icon; - } - }, - iconColor() { - if (!this.showEdit) { - this.currentIconColor = this.iconColor; - } - }, - backgroundType() { - if (!this.showEdit) { - this.currentBackgroundType = this.backgroundType; - } - }, - backgroundImageId() { - if (!this.showEdit) { - this.currentBackgroundImageId = this.backgroundImageId; - if (this.currentBackgroundImageId !== '') { - this.loadFile(); - } - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareIframeBlock.vue b/resources/vue/components/courseware/CoursewareIframeBlock.vue index ff9c6475626..1f0f5bf9b3a 100755 --- a/resources/vue/components/courseware/CoursewareIframeBlock.vue +++ b/resources/vue/components/courseware/CoursewareIframeBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle !== ''" class="cw-block-title">{{ currentTitle }}</div> @@ -19,7 +18,7 @@ allowfullscreen sandbox="allow-forms allow-popups allow-pointer-lock allow-same-origin allow-scripts" /> - <div v-if="currentCcInfo !== 'false'" class="cw-block-iframe-cc-data"> + <div v-if="currentCcInfo" class="cw-block-iframe-cc-data"> <span class="cw-block-iframe-cc" :class="['cw-block-iframe-cc-' + currentCcInfo]"></span> <div class="cw-block-iframe-cc-infos"> <p v-if="currentCcWork !== ''"><translate>Werk</translate> {{ currentCcWork }}</p> @@ -121,7 +120,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentUrl: '', currentHeight: '', @@ -199,9 +197,6 @@ export default { this.currentCcBase = this.ccBase; this.setProtocol(); }, - setShowEdit(state) { - this.showEdit = state; - }, setProtocol() { if (location.protocol === 'https:') { if (!this.currentUrl.includes('https:')) { @@ -239,58 +234,5 @@ export default { }); }, }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - url() { - if (!this.showEdit) { - this.currentUrl = this.url; - this.setProtocol(); - } - }, - height() { - if (!this.showEdit) { - this.currentHeight = this.height; - } - }, - submitUserId() { - if (!this.showEdit) { - this.currentSubmitUserId = this.submitUserId; - } - }, - submitParam() { - if (!this.showEdit) { - this.currentSubmitParam = this.submitParam; - } - }, - salt() { - if (!this.showEdit) { - this.currentSalt = this.salt; - } - }, - ccInfo() { - if (!this.showEdit) { - this.currentCcInfo = this.ccInfo; - } - }, - ccWork() { - if (!this.showEdit) { - this.currentCcWork = this.ccWork; - } - }, - ccAuthor() { - if (!this.showEdit) { - this.currentCcAuthor = this.ccAuthor; - } - }, - ccBase() { - if (!this.showEdit) { - this.currentCcBase = this.ccBase; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareImageMapBlock.vue b/resources/vue/components/courseware/CoursewareImageMapBlock.vue index df16aceba30..9ba60d662c1 100755 --- a/resources/vue/components/courseware/CoursewareImageMapBlock.vue +++ b/resources/vue/components/courseware/CoursewareImageMapBlock.vue @@ -5,12 +5,11 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> - <img v-if="currentUrl" :src="currentUrl" class="cw-image-map-original-img" ref="original_img" @load="buildCanvas" /> + <img :src="currentUrl" class="cw-image-map-original-img" ref="original_img" @load="buildCanvas" /> <canvas class="cw-image-map-canvas" ref="canvas"></canvas> <img class="cw-image-from-canvas" @@ -179,7 +178,6 @@ export default { }, data() { return { - showEdit: false, currentFileId: '', currentFile: {}, currentShapes: {}, @@ -217,11 +215,11 @@ export default { return this.block?.attributes?.payload?.shapes; }, currentUrl() { - if (this.currentFile.download_url) { + if (this.currentFile.download_url !== 'undefined') { return this.currentFile.download_url; + } else { + return ''; } - - return ''; }, }, mounted() { @@ -238,17 +236,10 @@ export default { await this.loadFile(); this.buildCanvas(); }, - setShowEdit(state) { - this.showEdit = state; - }, async loadFile() { const id = this.currentFileId; - let fileRef = null; - - if (id) { - await this.loadFileRef({ id }); - fileRef = this.fileRefById({ id }); - } + await this.loadFileRef({ id }); + const fileRef = this.fileRefById({ id }); if (fileRef) { this.updateCurrentFile({ @@ -280,18 +271,16 @@ export default { }, buildCanvas() { - if (this.currentUrl) { - let canvas = this.$refs.canvas; - let original_img = this.$refs.original_img; - canvas.width = 1085; - if (original_img.height > 0) { - canvas.height = Math.round((canvas.width / original_img.width) * original_img.height); - } else { - canvas.height = 484; - } - this.context = canvas.getContext('2d'); - this.drawScreen(); + let canvas = this.$refs.canvas; + let original_img = this.$refs.original_img; + canvas.width = 1085; + if (original_img.height > 0) { + canvas.height = Math.round((canvas.width / original_img.width) * original_img.height); + } else { + canvas.height = 484; } + this.context = canvas.getContext('2d'); + this.drawScreen(); }, drawScreen() { let context = this.context; @@ -530,17 +519,5 @@ export default { this.currentShapes[index].target_external = url; }, }, - watch: { - fileId() { - if (!this.showEdit) { - this.initCurrentData(); - } - }, - shapes() { - if (!this.showEdit) { - this.initCurrentData(); - } - } - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareKeyPointBlock.vue b/resources/vue/components/courseware/CoursewareKeyPointBlock.vue index fab09e2f42d..39124e548b9 100755 --- a/resources/vue/components/courseware/CoursewareKeyPointBlock.vue +++ b/resources/vue/components/courseware/CoursewareKeyPointBlock.vue @@ -5,10 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="closeEdit" - @showEdit="setShowEdit" @storeEdit="storeBlock" - + @closeEdit="closeEdit" > <template #content> <div class="cw-keypoint-content" :class="['cw-keypoint-' + currentColor]"> @@ -96,7 +94,6 @@ export default { }, data() { return { - showEdit: false, currentText: '', currentColor: '', currentIcon: '', @@ -184,9 +181,6 @@ export default { this.currentColor = this.color; this.currentIcon = this.icon; }, - setShowEdit(state) { - this.showEdit = state; - }, storeBlock() { let attributes = {}; attributes.payload = {}; @@ -207,22 +201,5 @@ export default { mounted() { this.initCurrentData(); }, - watch: { - text() { - if (!this.showEdit) { - this.currentText = this.text; - } - }, - color() { - if (!this.showEdit) { - this.currentColor = this.color; - } - }, - icon() { - if (!this.showEdit) { - this.currentIcon = this.icon; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareLinkBlock.vue b/resources/vue/components/courseware/CoursewareLinkBlock.vue index 270660eea10..a2fce7d0045 100755 --- a/resources/vue/components/courseware/CoursewareLinkBlock.vue +++ b/resources/vue/components/courseware/CoursewareLinkBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentType === 'external'"> @@ -77,7 +76,6 @@ export default { }, data() { return { - showEdit: false, currentType: '', currentTarget: '', currentUrl: '', @@ -116,9 +114,6 @@ export default { this.currentTitle = this.title; this.fixUrl(); }, - setShowEdit(state) { - this.showEdit = state; - }, fixUrl() { if ( this.currentUrl.indexOf('http://') !== 0 && @@ -150,27 +145,5 @@ export default { }, }, - watch: { - type() { - if (!this.showEdit) { - this.currentType = this.type; - } - }, - target() { - if (!this.showEdit) { - this.currentTarget = this.target; - } - }, - url() { - if (!this.showEdit) { - this.currentUrl = this.url; - } - }, - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue index 2cbda8d1359..3878ec6d0d7 100755 --- a/resources/vue/components/courseware/CoursewareStructuralElement.vue +++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue @@ -863,17 +863,16 @@ export default { } }, containers() { - let containers = []; - let relatedContainers = this.structuralElement?.relationships?.containers?.data; - - if (relatedContainers) { - for (const container of relatedContainers) { - containers.push(this.containerById({ id: container.id})); - } + if (!this.structuralElement) { + return []; } - return containers; - + return ( + this.relatedContainers({ + parent: this.structuralElement, + relationship: 'containers', + }) ?? [] + ); }, noContainers() { if (this.containers === null) { @@ -1109,10 +1108,10 @@ export default { return ''; }, blocked() { - return this.structuralElement?.relationships?.['edit-blocker']?.data !== null; + return this.structuralElement?.relationships['edit-blocker'].data !== null; }, blockerId() { - return this.blocked ? this.structuralElement?.relationships?.['edit-blocker']?.data?.id : null; + return this.blocked ? this.structuralElement?.relationships['edit-blocker'].data?.id : null; }, blockedByThisUser() { return this.blocked && this.userId === this.blockerId; diff --git a/resources/vue/components/courseware/CoursewareTableOfContentsBlock.vue b/resources/vue/components/courseware/CoursewareTableOfContentsBlock.vue index d671429cc83..c5d268ef988 100755 --- a/resources/vue/components/courseware/CoursewareTableOfContentsBlock.vue +++ b/resources/vue/components/courseware/CoursewareTableOfContentsBlock.vue @@ -5,9 +5,8 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" - @storeEdit="storeBlock" + @storeEdit="storeText" + @closeEdit="closeEdit" > <template #content> <div v-if="currentStyle !== 'tiles' && currentTitle !== ''" class="cw-block-title">{{ currentTitle }}</div> @@ -103,7 +102,6 @@ export default { }, data() { return { - showEdit: false, currentTitle: '', currentStyle: '', }; @@ -170,10 +168,10 @@ export default { this.currentTitle = this.title; this.currentStyle = this.style; }, - setShowEdit(state) { - this.showEdit = state; + closeEdit() { + this.initCurrentData(); }, - storeBlock() { + storeText() { let attributes = {}; attributes.payload = {}; attributes.payload.title = this.currentTitle; @@ -221,17 +219,5 @@ export default { return false; } }, - watch: { - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - style() { - if (!this.showEdit) { - this.currentStyle = this.style; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareTabsContainer.vue b/resources/vue/components/courseware/CoursewareTabsContainer.vue index 6615b0f69b9..747b24a5930 100755 --- a/resources/vue/components/courseware/CoursewareTabsContainer.vue +++ b/resources/vue/components/courseware/CoursewareTabsContainer.vue @@ -4,10 +4,9 @@ containerClass="cw-container-tabs" :canEdit="canEdit" :isTeacher="isTeacher" + @storeContainer="storeContainer" @closeEdit="initCurrentData" - @showEdit="setShowEdit" @sortBlocks="enableSort" - @storeContainer="storeContainer" > <template v-slot:containerContent> <courseware-tabs v-if="!sortMode"> @@ -130,7 +129,6 @@ export default { }, data() { return { - showEdit: false, currentContainer: null, currentSections: [], textDeleteSection: this.$gettext('Sektion entfernen'), @@ -183,9 +181,6 @@ export default { this.currentSections = sections; }, - setShowEdit(state) { - this.showEdit = state; - }, addSection() { this.currentContainer.attributes.payload.sections.push({ name: '', icon: '', blocks: [] }); }, @@ -248,9 +243,7 @@ export default { }, watch: { blocks() { - if (!this.showEdit) { - this.initCurrentData(); - } + this.initCurrentData(); } } }; diff --git a/resources/vue/components/courseware/CoursewareTypewriterBlock.vue b/resources/vue/components/courseware/CoursewareTypewriterBlock.vue index 5d131a280cc..abdc8ebe368 100755 --- a/resources/vue/components/courseware/CoursewareTypewriterBlock.vue +++ b/resources/vue/components/courseware/CoursewareTypewriterBlock.vue @@ -5,12 +5,11 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" - @storeEdit="storeBlock" + @storeEdit="storeText" + @closeEdit="closeEdit" > <template #content> - <div v-if="currentText !== ''" class="cw-typewriter-content"> + <div class="cw-typewriter-content"> <vue-typer :text="currentText" initial-action="typing" @@ -84,8 +83,8 @@ export default { }, data() { return { - showEdit: false, speeds: [200, 100, 50, 25], + typing: false, speedClasses: [ 'cw-typewriter-letter-fadein-slow', 'cw-typewriter-letter-fadein-normal', @@ -128,9 +127,6 @@ export default { this.currentFont = this.font; this.currentSize = this.size; }, - setShowEdit(state) { - this.showEdit = state; - }, restartTyping() { let text = this.currentText; this.currentText = ' '; @@ -138,7 +134,10 @@ export default { this.currentText = text; }); }, - storeBlock() { + closeEdit() { + this.initCurrentData(); + }, + storeText() { let attributes = {}; attributes.payload = {}; attributes.payload.text = this.currentText; @@ -153,28 +152,5 @@ export default { }); } }, - watch: { - text() { - if (!this.showEdit) { - this.currentText = this.text; - } - }, - speed() { - if (!this.showEdit) { - this.currentSpeed = this.speed; - this.restartTyping(); - } - }, - font() { - if (!this.showEdit) { - this.currentFont = this.font; - } - }, - size() { - if (!this.showEdit) { - this.currentSize = this.size; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/CoursewareVideoBlock.vue b/resources/vue/components/courseware/CoursewareVideoBlock.vue index ee607e047dc..e5e31fcab43 100755 --- a/resources/vue/components/courseware/CoursewareVideoBlock.vue +++ b/resources/vue/components/courseware/CoursewareVideoBlock.vue @@ -5,13 +5,11 @@ :canEdit="canEdit" :isTeacher="isTeacher" :preview="true" - @closeEdit="initCurrentData" - @showEdit="setShowEdit" @storeEdit="storeBlock" + @closeEdit="initCurrentData" > <template #content> <div v-if="currentTitle !== '' && currentURL" class="cw-block-title">{{ currentTitle }}</div> - <div v-if="!currentURL" class="cw-block-title">{{ currentTitle ? currentTitle : $gettext('Video') }}</div> <video v-show="currentURL" :src="currentURL" @@ -20,9 +18,6 @@ :autoplay="currentAutoplay === 'enabled'" @contextmenu="contextHandler" /> - <div v-if="!currentURL" class="cw-file-empty"> - <p><translate>Es ist keine Video-Datei verfügbar</translate></p> - </div> </template> <template v-if="canEdit" #edit> <form class="default" @submit.prevent=""> @@ -82,7 +77,6 @@ import CoursewareDefaultBlock from './CoursewareDefaultBlock.vue'; import CoursewareFileChooser from './CoursewareFileChooser.vue'; import { mapActions, mapGetters } from 'vuex'; - export default { name: 'courseware-video-block', components: { @@ -96,7 +90,6 @@ export default { }, data() { return { - showEdit: false, currentSource: '', currentTitle: '', currentFile: {}, @@ -183,7 +176,7 @@ export default { containerId: this.block.relationships.container.data.id, }); }, - initCurrentData() { + async initCurrentData() { this.currentSource = this.source; this.currentTitle = this.title; this.currentWebUrl = this.webUrl; @@ -192,12 +185,9 @@ export default { this.currentContextMenu = this.contextMenu; this.currentAutoplay = this.autoplay; if (this.fileId !== '') { - this.loadFile(); + await this.loadFile(); } }, - setShowEdit(state) { - this.showEdit = state; - }, async loadFile() { const id = this.currentFileId; await this.loadFileRef({ id }); @@ -225,45 +215,5 @@ export default { } }, }, - watch: { - source() { - if (!this.showEdit) { - this.currentSource = this.source; - } - }, - title() { - if (!this.showEdit) { - this.currentTitle = this.title; - } - }, - webUrl() { - if (!this.showEdit) { - this.currentWebUrl = this.webUrl; - } - }, - fileId() { - if (!this.showEdit) { - this.currentFileId = this.fileId; - if (this.fileId !== '') { - this.loadFile(); - } - } - }, - aspect() { - if (!this.showEdit) { - this.currentAspect = this.aspect; - } - }, - contextMenu() { - if (!this.showEdit) { - this.currentContextMenu = this.contextMenu; - } - }, - autoplay() { - if (!this.showEdit) { - this.currentAutoplay = this.autoplay; - } - }, - } }; </script> diff --git a/resources/vue/components/courseware/IndexApp.vue b/resources/vue/components/courseware/IndexApp.vue index 2d50abfba43..5d9f1d202c1 100755 --- a/resources/vue/components/courseware/IndexApp.vue +++ b/resources/vue/components/courseware/IndexApp.vue @@ -65,8 +65,7 @@ export default { canVisit: null, selected: null, structureLoadingState: 'idle', - loadingErrorStatus: null, - polling: null + loadingErrorStatus: null }), computed: { ...mapGetters({ @@ -90,9 +89,6 @@ export default { default: return this.$gettext('Beim Laden der Seite ist ein Fehler aufgetreten.'); } - }, - selectedId() { - return this.$route.params?.id; } }, methods: { @@ -113,11 +109,6 @@ export default { this.canVisit = this.structuralElementLastMeta['can-visit']; this.selected = this.structuralElementById({ id }); }, - pollData () { - this.polling = setInterval(async () => { - await this.selectStructuralElement(this.selectedId); - }, 4000); - } }, async mounted() { this.structureLoadingState = 'loading'; @@ -135,10 +126,6 @@ export default { this.structureLoadingState = 'done'; const selectedId = this.$route.params?.id; await this.selectStructuralElement(selectedId); - this.pollData(); - }, - beforeDestroy () { - clearInterval(this.polling) }, watch: { $route(to) { diff --git a/resources/vue/components/courseware/block-mixin.js b/resources/vue/components/courseware/block-mixin.js index eb544c77258..2e084baf116 100755 --- a/resources/vue/components/courseware/block-mixin.js +++ b/resources/vue/components/courseware/block-mixin.js @@ -20,11 +20,5 @@ export const blockMixin = { ...mapActions({ updateUserProgress: 'courseware-user-progresses/update', }), - contentsEqual(o1, o2) { - return typeof o1 === 'object' && Object.keys(o1).length > 0 - ? Object.keys(o1).length === Object.keys(o2).length - && Object.keys(o1).every(p => this.contentsEqual(o1[p], o2[p])) - : o1 === o2; - } }, }; diff --git a/resources/vue/store/courseware/courseware.module.js b/resources/vue/store/courseware/courseware.module.js index 9a511100f9d..49ac520a5d4 100755 --- a/resources/vue/store/courseware/courseware.module.js +++ b/resources/vue/store/courseware/courseware.module.js @@ -224,7 +224,7 @@ export const state = { ...initialState }; export const actions = { loadContainer({ dispatch }, containerId) { const options = { - include: 'blocks,blocks.edit-blocker', + include: 'blocks', }; return dispatch('courseware-containers/loadById', { id: containerId, options }, { root: true }); -- GitLab