Skip to content

Commit a459b6a

Browse files
author
Markus Guder
committed
update
1 parent 131963a commit a459b6a

5 files changed

Lines changed: 21 additions & 12 deletions

File tree

client/app/components/home/categories/categories.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414

1515
<section style="padding: 1rem;" *ngIf="dataIsAvailable">
16-
<div class="card" *ngFor="let category of categories; let i=index" (click)="routeToCourse(category.RUB_ID, colorArray[i])">
16+
<div class="card" *ngFor="let category of categories; let i=index" (click)="routeToCourse(category.RUB_ID, colorArray[i], category.RUB_NAME)">
1717
<div class="color-marker" [ngClass]="colorArray[i]">
1818
</div>
1919
<div class="card-content">

client/app/components/home/categories/categories.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export class CategoriesComponent implements OnInit {
2424
});
2525
}
2626

27-
routeToCourse(categoryId: number, color: string) {
27+
routeToCourse(categoryId: number, color: string, category: string) {
2828
this.router.navigateByUrl('home/kurs-uebersicht/' + categoryId);
29-
this.comService.setColor(color);
29+
this.comService.setInfo(color, category);
3030
}
3131

3232
}

client/app/components/home/courses/courses.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<div class="circleBackground" #backgroundElement></div>
33
<div class="columns is-mobile">
44
<div class="column is-12" style="z-index: 0; padding: 2rem; padding-left: 5rem;">
5-
<div style="font-size: 1.5rem; color:white;">
6-
Kurs Kategorien
5+
<div style="font-size: 1.5rem; color:white;" >
6+
{{headerText}} - Kurse
77
</div>
88
</div>
99
</div>

client/app/components/home/courses/courses.component.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export class CoursesComponent implements AfterViewInit {
1717

1818
public dataIsAvailable: boolean = false;
1919
public courses: Array<any>;
20-
public headerText: string;
20+
public headerText: string = "";
21+
public category: string = "";
2122

2223
constructor(
2324
public categoryService: CategoryService,
@@ -28,8 +29,9 @@ export class CoursesComponent implements AfterViewInit {
2829
public renderer: Renderer2) {}
2930

3031
ngAfterViewInit() {
31-
this.comService.getColor().subscribe(color => {
32-
this.renderer.addClass(this.backgroundElement.nativeElement, color);
32+
this.comService.getInfo().subscribe(response => {
33+
this.category = response.category;
34+
this.renderer.addClass(this.backgroundElement.nativeElement, response.color);
3335
});
3436

3537
this.activatedRoute.params.subscribe((params: Params) => {
@@ -43,11 +45,11 @@ export class CoursesComponent implements AfterViewInit {
4345
}
4446

4547
requestCoursesByUser():void{
48+
this.headerText = "Meine";
4649
this.userService.getCoursesByUser().subscribe(response =>{
4750
response.forEach(element => {
4851
this.courses = [];
4952
this.coursesService.getCoursesByCourseId(element.ANM_KURS_ID).subscribe(response => {
50-
console.log(response);
5153
response.ANM_DATUM = element.ANM_DATUM;
5254
this.courses.push(response);
5355
});
@@ -59,6 +61,7 @@ export class CoursesComponent implements AfterViewInit {
5961
}
6062

6163
requestCoursesByCategory(courseId: string):void{
64+
this.headerText = this.category;
6265
this.categoryService.getCoursesByCategoryId(courseId).subscribe(response =>{
6366
this.courses = response;
6467
if(response.name != "HttpResponseError"){

client/app/components/home/shared/communication.service.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export class CommunicationService{
88

99
public instruction_sub_comb = new Subject<any>();
1010
private color: string;
11+
private category: string;
1112

1213
constructor() {
1314
}
@@ -16,12 +17,17 @@ export class CommunicationService{
1617
this.instruction_sub_comb.next(message);
1718
}
1819

19-
setColor(color: string) {
20+
setInfo(color: string, category: string) {
2021
this.color = color;
22+
this.category = category;
2123
}
2224

23-
getColor(): Observable<string>{
24-
return Observable.of(this.color);
25+
getInfo(): Observable<any>{
26+
return Observable.of(
27+
{
28+
'color': this.color,
29+
'category': this.category
30+
});
2531
}
2632

2733
}

0 commit comments

Comments
 (0)