From cc912cebe2d980b5106ceb2477862665065dbd63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de>
Date: Tue, 26 Feb 2019 02:52:00 +0100
Subject: [PATCH] Open dialog when info-button is clicked

---
 src/app/components/shared/shared.module.ts    |  3 ++-
 .../statistics-page.component.html            |  2 +-
 .../statistics-page.component.ts              | 21 ++++++++++++-------
 3 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/src/app/components/shared/shared.module.ts b/src/app/components/shared/shared.module.ts
index 2c43d6168..8c6b346aa 100644
--- a/src/app/components/shared/shared.module.ts
+++ b/src/app/components/shared/shared.module.ts
@@ -71,7 +71,8 @@ import { StatisticHelpComponent } from './_dialogs/statistic-help/statistic-help
   ],
   entryComponents: [
     RoomCreateComponent,
-    LoginComponent
+    LoginComponent,
+    StatisticHelpComponent
   ]
 })
 export class SharedModule {
diff --git a/src/app/components/shared/statistics-page/statistics-page.component.html b/src/app/components/shared/statistics-page/statistics-page.component.html
index 2ff7c225e..b77305510 100644
--- a/src/app/components/shared/statistics-page/statistics-page.component.html
+++ b/src/app/components/shared/statistics-page/statistics-page.component.html
@@ -3,7 +3,7 @@
     <mat-card-header>
       <h2>{{'statistic.learning-status' | translate}}</h2>
       <span class="fill-remaining-space"></span>
-      <button mat-icon-button><mat-icon color="primary">help</mat-icon></button>
+      <button mat-icon-button (click)="showHelp()"><mat-icon color="primary">help</mat-icon></button>
     </mat-card-header>
     <mat-divider></mat-divider>
     <div *ngIf="isLoading"                                                                                                                                                                                                                                                                                                                                                          fxLayout="column" fxLayoutAlign="center" fxLayoutGap="20px" fxFill>
diff --git a/src/app/components/shared/statistics-page/statistics-page.component.ts b/src/app/components/shared/statistics-page/statistics-page.component.ts
index ae3b5bc18..b1ca52aa6 100644
--- a/src/app/components/shared/statistics-page/statistics-page.component.ts
+++ b/src/app/components/shared/statistics-page/statistics-page.component.ts
@@ -5,7 +5,8 @@ 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';
+import { MatTabGroup, MatDialog } from '@angular/material';
+import { StatisticHelpComponent } from '../_dialogs/statistic-help/statistic-help.component';
 
 @Component({
   selector: 'app-statistics',
@@ -22,12 +23,12 @@ export class StatisticsPageComponent implements OnInit {
 
   @ViewChild(MatTabGroup) tabGroup: MatTabGroup;
 
-  constructor(
-    private route: ActivatedRoute,
-    private roomService: RoomService,
-    private translateService: TranslateService,
-    protected langService: LanguageService) {
-    langService.langEmitter.subscribe(lang => translateService.use(lang));
+  constructor(private route: ActivatedRoute,
+              private roomService: RoomService,
+              private translateService: TranslateService,
+              protected langService: LanguageService,
+              public dialog: MatDialog,) {
+              langService.langEmitter.subscribe(lang => translateService.use(lang));
   }
 
   ngOnInit(): void {
@@ -49,4 +50,10 @@ export class StatisticsPageComponent implements OnInit {
     });
   }
 
+  showHelp(): void {
+    this.dialog.open(StatisticHelpComponent, {
+      width: '350px'
+    });
+  }
+
 }
-- 
GitLab