This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit cfa1bfe5 authored by Michael Breu's avatar Michael Breu
Browse files

Intermediate commit parent.title

parent 77cb8826
Branches
2 merge requests!231New Deployment into production and update gitlab,!225Resolve "Collections mehr hervorheben"
import { HttpResponse } from '@angular/common/http';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { AfterViewInit, Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { Router } from '@angular/router';
import { faArrowRight, faFolderOpen } from '@fortawesome/free-solid-svg-icons';
import { ReviewManagementService } from 'app/admin/review-management/review-management.service';
......@@ -78,7 +78,7 @@ export class ExerciseHeaderComponent {
templateUrl: './exerciseComponents/exercise-body.component.html',
styleUrls: ['./exerciseComponents/exercise-body.component.scss'],
})
export class ExerciseBodyComponent implements OnInit, OnDestroy {
export class ExerciseBodyComponent implements OnInit, OnDestroy, AfterViewInit {
@Output() exerciseChangedEvent = new EventEmitter<SearchResultDTO>();
@Input() get referencedExercise(): SearchResultDTO | undefined {
return this.exercise;
......@@ -88,6 +88,8 @@ export class ExerciseBodyComponent implements OnInit, OnDestroy {
}
exercise: ExtendedSearchResultDTO | undefined;
parent: SearchResultDTO | undefined;
bookmarked = false;
downloadWithChildren = false;
......@@ -213,6 +215,7 @@ export class ExerciseBodyComponent implements OnInit, OnDestroy {
next: searchResult => {
this.exercise = this.exerciseService.populateExerciseWithData(searchResult);
this.exerciseChangedEvent.emit(this.exercise);
this.updateParent(this.exercise);
},
error: () => {
alert(`exercise ${exerciseId} cannot be loaded`);
......@@ -296,6 +299,23 @@ export class ExerciseBodyComponent implements OnInit, OnDestroy {
});
}
ngAfterViewInit(): void {
this.updateParent(this.exercise!);
}
updateParent(exercise: ExtendedSearchResultDTO): void {
if (this.exercise!.file.parentId) {
this.exerciseService.loadExercise(this.exercise!.file.parentId).subscribe({
next: searchResult => {
this.parent = searchResult;
},
error: () => {
alert(`exercise ${this.exercise!.file.parentId} cannot be loaded`);
},
});
}
}
ngOnDestroy(): void {
if (this.authSubscription) {
this.authSubscription.unsubscribe();
......
......@@ -154,7 +154,8 @@
(click)="toParent(exercise.file.parentId)"
>
<span jhiTranslate="exercise.containedIn">This exercise is contained in</span>:
<span>
<span
>{{ parent!.metadata.title }}
<fa-icon style="padding: 5px 0px 0px 5px" container="body" [icon]="treeIcon"></fa-icon>
</span>
</div>
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment