Skip to content
Snippets Groups Projects
Commit 9a595d54 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Merge branch '192-content-management' into 'master'

Fix statistics-landing-tab

Closes #192

See merge request arsnova/arsnova-lite!136
parents e0590ee7 6983a09b
Branches
Tags
No related merge requests found
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { RoomService } from '../../../services/http/room.service';
import { ContentGroup } from '../../../models/content-group';
import { Room } from '../../../models/room';
import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service';
import { MatTabGroup } from '@angular/material';
@Component({
selector: 'app-statistics',
......@@ -17,6 +18,9 @@ export class StatisticsPageComponent implements OnInit {
room: Room;
contentGroups: ContentGroup[];
isLoading = true;
currentCG: string;
@ViewChild(MatTabGroup) tabGroup: MatTabGroup;
constructor(
private route: ActivatedRoute,
......@@ -27,7 +31,9 @@ export class StatisticsPageComponent implements OnInit {
}
ngOnInit(): void {
this.currentCG = sessionStorage.getItem('contentGroup');
this.getRoom(localStorage.getItem('roomId'));
this.tabGroup.selectedIndex = 1;
}
getRoom(id: string): void {
......@@ -35,6 +41,11 @@ export class StatisticsPageComponent implements OnInit {
this.roomService.getRoom(id).subscribe(room => {
this.contentGroups = room.contentGroups;
this.isLoading = false;
for (let i = 0; i < this.contentGroups.length; i++) {
if (this.currentCG.includes(this.contentGroups[i].name)) {
this.tabGroup.selectedIndex = i;
}
}
});
}
......
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