diff --git a/resources/vue/components/courseware/CoursewareStructuralElement.vue b/resources/vue/components/courseware/CoursewareStructuralElement.vue index 0c03fc67db972b3593c93f0bb95c176b59dc64c0..b24840e03895035975b142a0b2f06f7714ab56c4 100644 --- a/resources/vue/components/courseware/CoursewareStructuralElement.vue +++ b/resources/vue/components/courseware/CoursewareStructuralElement.vue @@ -636,7 +636,12 @@ v-if="currentElement !== ''" :msgCompanion="textCompanionWrongContext" mood="sad" - /> + > + <template v-slot:companionActions > + <a class="button" :href="unitRootUrl">{{ $gettext('Lernmaterial neu laden') }}</a> + <a class="button" :href="shelfURL">{{ $gettext('Zurück zur Lernmaterialübersicht') }}</a> + </template> + </courseware-companion-box> </div> </div> </focus-trap> @@ -863,13 +868,26 @@ export default { }, validContext() { - let valid = false; + if (this.context.type === 'sharedusers') { + if (this.context.id === this.courseware.relationships.root.data.id) { + return true; + } + } + + if (this.context.type === 'public') { + return true; + } + + if (this.context.unit !== this.currentElement.relationships?.unit?.data?.id) { + return false; + } + if (this.context.type === 'courses' && this.currentElement.relationships) { if ( this.currentElement.relationships.course && this.context.id === this.currentElement.relationships.course.data.id ) { - valid = true; + return true; } } @@ -878,20 +896,12 @@ export default { this.currentElement.relationships.user && this.context.id === this.currentElement.relationships.user.data.id ) { - valid = true; - } - } - if (this.context.type === 'sharedusers') { - if (this.context.id === this.courseware.relationships.root.data.id) { - valid = true; + return true; } } + - if (this.context.type === 'public') { - valid = true; - } - - return valid; + return false; }, image() { @@ -1225,6 +1235,18 @@ export default { }, progressTitle() { return ''; + }, + shelfURL() { + return STUDIP.URLHelper.getURL( + 'dispatch.php/course/courseware/', + {cid: this.context.id} + ); + }, + unitRootUrl() { + return STUDIP.URLHelper.getURL( + 'dispatch.php/course/courseware/courseware/' + this.context.unit, + {cid: this.context.id} + ); } },