From cfac2a5baf9da80b5862b08de44b69a38f62d4dd Mon Sep 17 00:00:00 2001
From: mechtelm <nicht@mehr.fragen>
Date: Sun, 24 Feb 2019 00:23:23 +0100
Subject: [PATCH] page title removed, tc component has now nav area

---
 src/app/about/about.component.html            |  5 ++++
 src/app/about/about.component.ts              | 12 +++------
 src/app/app.component.html                    | 10 +-------
 src/app/app.component.scss                    | 15 -----------
 src/app/app.component.ts                      | 25 ++-----------------
 src/app/logindata.service.ts                  |  4 ---
 src/app/start/start.component.html            |  8 +++++-
 src/app/start/start.component.ts              |  1 -
 src/app/sys-check/run.component.html          |  6 +++++
 src/app/sys-check/run.component.ts            |  1 +
 src/app/sys-check/start.component.html        |  5 ++++
 src/app/sys-check/syscheck-data.service.ts    |  6 -----
 .../test-controller-routing.module.ts         | 22 ++++++++--------
 .../test-controller.component.css             |  8 ++++++
 .../test-controller.component.html            |  9 ++++---
 .../test-controller.component.ts              |  2 --
 .../test-controller.service.ts                |  3 ---
 .../unithost/unithost.component.css           | 11 +++++++-
 .../unithost/unithost.component.html          |  3 +++
 .../unithost/unithost.component.ts            |  3 ++-
 src/index.html                                |  2 +-
 src/styles.css                                | 23 +++++++++++++----
 22 files changed, 90 insertions(+), 94 deletions(-)

diff --git a/src/app/about/about.component.html b/src/app/about/about.component.html
index b0703204..e3cae7cc 100644
--- a/src/app/about/about.component.html
+++ b/src/app/about/about.component.html
@@ -1,3 +1,8 @@
+<div class="logo">
+  <a [routerLink]="['/']">
+    <img src="assets/IQB-LogoA.png" matTooltip="Startseite"/>
+  </a>
+</div>
 <div class="page-body">
   <div fxLayout="row" fxLayoutAlign="center start">
     <mat-card fxFlex="0 2 500px">
diff --git a/src/app/about/about.component.ts b/src/app/about/about.component.ts
index 7fdb646a..cd480ad4 100644
--- a/src/app/about/about.component.ts
+++ b/src/app/about/about.component.ts
@@ -1,19 +1,13 @@
-import { Component, Inject, OnInit } from '@angular/core';
-import { LogindataService } from '../logindata.service';
+import { Component, Inject } from '@angular/core';
 
 @Component({
   templateUrl: './about.component.html'
 })
-export class AboutComponent implements OnInit {
+export class AboutComponent {
 
   constructor(
     @Inject('APP_NAME') private appName: string,
     @Inject('APP_PUBLISHER') private appPublisher: string,
-    @Inject('APP_VERSION') private appVersion: string,
-    private lds: LogindataService
+    @Inject('APP_VERSION') private appVersion: string
   ) { }
-
-  ngOnInit() {
-    this.lds.pageTitle$.next('');
-  }
 }
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 0be6ebdc..90c6b646 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,9 +1 @@
-<mat-toolbar>
-  <a [routerLink]="['/']">
-    <img class="logo" src="assets/IQB-LogoA.png" matTooltip="Startseite"/>
-  </a>
-  <span>{{ title }}</span>
-  <span class="itp-fill-remaining-space"></span>
-</mat-toolbar>
-
-<router-outlet></router-outlet>
+<router-outlet></router-outlet>
\ No newline at end of file
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index 5a3e16aa..0edce946 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -20,18 +20,3 @@ mat-toolbar > span {
   white-space: nowrap;
   overflow: hidden;
 }
-
-.logo {
-  width: 80px;
-  margin-right: 20px;
-  margin-top: 12px;
-}
-
-// button.mat-menu-item {
-//   margin: 0px;
-// }
-
-// .material-icons {
-//   font-size: 1.6rem;
-// }
-
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 445ed926..88155c5c 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,10 +1,4 @@
-import { SyscheckDataService } from './sys-check/syscheck-data.service';
-import { TestControllerService } from './test-controller';
 import { LogindataService } from './logindata.service';
-import { merge } from 'rxjs';
-
-// import { TestdataService } from './test-controller';
-import { Router } from '@angular/router';
 import { Component, OnInit } from '@angular/core';
 
 @Component({
@@ -15,27 +9,12 @@ import { Component, OnInit } from '@angular/core';
 
 
 export class AppComponent implements OnInit {
-  public title = '';
 
   constructor (
-    private lds: LogindataService,
-    private tcs: TestControllerService,
-    private ccs: SyscheckDataService,
-    private router: Router) { }
+    private lds: LogindataService
+  ) { }
 
   ngOnInit() {
-
-    merge(
-      this.ccs.pageTitle$,
-      this.lds.pageTitle$,
-      this.tcs.pageTitle$).subscribe(t => {
-        this.title = t;
-      });
-
-    this.lds.pageTitle$.subscribe(t => {
-      this.title = t;
-    });
-
     // give a message to the central message broadcast
     window.addEventListener('message', (event: MessageEvent) => {
       const msgData = event.data;
diff --git a/src/app/logindata.service.ts b/src/app/logindata.service.ts
index b4448bef..d0872c50 100644
--- a/src/app/logindata.service.ts
+++ b/src/app/logindata.service.ts
@@ -7,10 +7,6 @@ import { Injectable } from '@angular/core';
   providedIn: 'root'
 })
 export class LogindataService {
-
-  // observed only by app.components for the page header
-  public pageTitle$ = new BehaviorSubject<string>('IQB-Testcenter');
-
   // key for test-controller
   // only these two are stored in localStorage
   public bookletDbId$ = new BehaviorSubject<number>(0);
diff --git a/src/app/start/start.component.html b/src/app/start/start.component.html
index 144a80fb..76f9c08f 100644
--- a/src/app/start/start.component.html
+++ b/src/app/start/start.component.html
@@ -1,3 +1,8 @@
+<div class="logo">
+  <a [routerLink]="['/']">
+    <img src="assets/IQB-LogoA.png" matTooltip="Startseite"/>
+  </a>
+</div>
 <div class="page-body">
     <div class="spinner-container" *ngIf="dataLoading">
       <mat-spinner></mat-spinner>
@@ -125,7 +130,8 @@
       </mat-card-content>
       <mat-card-actions>
         <button mat-raised-button color="foreground" [routerLink]="['/about']">Impressum/Datenschutz</button>
-        <button mat-raised-button color="foreground" [routerLink]="['/check']">System-Check</button>
+        <!-- if you like to activate system-check, the unit will not work anymore (navi-buttons) -->
+        <!-- <button mat-raised-button color="foreground" [routerLink]="['/check']">System-Check</button> -->
       </mat-card-actions>
     </mat-card>
   </div>
diff --git a/src/app/start/start.component.ts b/src/app/start/start.component.ts
index 72d4e1c2..c2fee214 100644
--- a/src/app/start/start.component.ts
+++ b/src/app/start/start.component.ts
@@ -48,7 +48,6 @@ export class StartComponent implements OnInit {
   }
 
   ngOnInit() {
-    this.lds.pageTitle$.next('');
     this.lds.loginStatusText$.subscribe(t => this.loginStatusText = t);
 
     this.lds.personToken$.subscribe(pt => {
diff --git a/src/app/sys-check/run.component.html b/src/app/sys-check/run.component.html
index b921d288..a59d4804 100644
--- a/src/app/sys-check/run.component.html
+++ b/src/app/sys-check/run.component.html
@@ -1,3 +1,9 @@
+<div class="logo">
+  <a [routerLink]="['/']">
+    <img src="assets/IQB-LogoA.png" matTooltip="Startseite"/>
+  </a>
+</div>
+<div class="pagetitle">{{ pagetitle }}</div>
 <div class="spinner-container" *ngIf="dataLoading">
   <mat-spinner></mat-spinner>
 </div>
diff --git a/src/app/sys-check/run.component.ts b/src/app/sys-check/run.component.ts
index bf6c976a..b5c85a86 100644
--- a/src/app/sys-check/run.component.ts
+++ b/src/app/sys-check/run.component.ts
@@ -31,6 +31,7 @@ export class RunComponent implements OnInit {
   saveEnabled = false;
   questionsonlymode = false;
   skipnetwork = false;
+  pagetitle = 'IQB-Testcenter: System-Check';
 
 
   constructor(
diff --git a/src/app/sys-check/start.component.html b/src/app/sys-check/start.component.html
index 0b9e84b6..b9a21e44 100644
--- a/src/app/sys-check/start.component.html
+++ b/src/app/sys-check/start.component.html
@@ -1,3 +1,8 @@
+<div class="logo">
+  <a [routerLink]="['/']">
+    <img src="assets/IQB-LogoA.png" matTooltip="Startseite"/>
+  </a>
+</div>
 <div class="spinner-container" *ngIf="dataLoading">
   <mat-spinner></mat-spinner>
 </div>
diff --git a/src/app/sys-check/syscheck-data.service.ts b/src/app/sys-check/syscheck-data.service.ts
index 1107a063..d26e6517 100644
--- a/src/app/sys-check/syscheck-data.service.ts
+++ b/src/app/sys-check/syscheck-data.service.ts
@@ -8,8 +8,6 @@ import { Injectable } from '@angular/core';
   providedIn: 'root'
 })
 export class SyscheckDataService {
-  public pageTitle$ = new BehaviorSubject<string>('IQB-Testcenter - System-Check');
-
   public checkConfig$ = new BehaviorSubject<CheckConfigData>(null);
   public environmentData$ = new BehaviorSubject<ReportEntry[]>([]);
   public networkData$ = new BehaviorSubject<ReportEntry[]>([]);
@@ -31,8 +29,4 @@ export class SyscheckDataService {
       this.questionnaireData$.next([]);
     });
   }
-
-  setPageTitle() {
-    this.pageTitle$.next('IQB-Testcenter - System-Check');
-  }
 }
diff --git a/src/app/test-controller/test-controller-routing.module.ts b/src/app/test-controller/test-controller-routing.module.ts
index 6cd84d71..0ffc1243 100644
--- a/src/app/test-controller/test-controller-routing.module.ts
+++ b/src/app/test-controller/test-controller-routing.module.ts
@@ -9,16 +9,18 @@ import { Routes, RouterModule } from '@angular/router';
 const routes: Routes = [
   {
     path: '',
-    component: TestControllerComponent
-  },
-  {
-    path: 'u/:u',
-      component: UnithostComponent,
-      canActivate: [UnitActivateGuard],
-      canDeactivate: [UnitDeactivateGuard]
-        // resolve: {
-        //   unitData: UnitResolver
-        // }
+    component: TestControllerComponent,
+    children: [
+      {
+        path: 'u/:u',
+          component: UnithostComponent,
+          canActivate: [UnitActivateGuard],
+          canDeactivate: [UnitDeactivateGuard]
+            // resolve: {
+            //   unitData: UnitResolver
+            // }
+      }
+    ]
   }
 ];
 
diff --git a/src/app/test-controller/test-controller.component.css b/src/app/test-controller/test-controller.component.css
index 13bb0665..6ca5d21b 100644
--- a/src/app/test-controller/test-controller.component.css
+++ b/src/app/test-controller/test-controller.component.css
@@ -17,3 +17,11 @@
 .errorMsg {
   color: brown;
 }
+
+.tc-body {
+  overflow-x: auto;
+  position: absolute;
+  width: 100%;
+  top: 65px;
+  bottom: 0;
+}
diff --git a/src/app/test-controller/test-controller.component.html b/src/app/test-controller/test-controller.component.html
index 14446bdd..831568c4 100644
--- a/src/app/test-controller/test-controller.component.html
+++ b/src/app/test-controller/test-controller.component.html
@@ -1,8 +1,11 @@
-<!-- <tc-menu-buttons></tc-menu-buttons> -->
-<tc-navi-buttons></tc-navi-buttons>
+<div class="logo">
+  <a [routerLink]="['/']">
+    <img src="assets/IQB-LogoA.png" matTooltip="Startseite"/>
+  </a>
+</div>
 <div class="spinner-container" *ngIf="dataLoading">
   <mat-spinner></mat-spinner>
 </div>
-<div class="page-body">
+<div class="tc-body">
     <router-outlet></router-outlet>
 </div>
diff --git a/src/app/test-controller/test-controller.component.ts b/src/app/test-controller/test-controller.component.ts
index c25600c2..fb4b4a68 100644
--- a/src/app/test-controller/test-controller.component.ts
+++ b/src/app/test-controller/test-controller.component.ts
@@ -94,8 +94,6 @@ export class TestControllerComponent implements OnInit {
     if (cu >= 0) {
       this.statusMsg = '';
     } else {
-      // this.tcs.pageTitle$.next('IQB-Testcenter');
-
       if (this.allUnits.length === 0) {
         this.statusMsg = 'Es stehen keine Informationen über ein gewähltes Testheft zur Verfügung.';
       } else {
diff --git a/src/app/test-controller/test-controller.service.ts b/src/app/test-controller/test-controller.service.ts
index 7cd44377..2d0286ab 100644
--- a/src/app/test-controller/test-controller.service.ts
+++ b/src/app/test-controller/test-controller.service.ts
@@ -11,9 +11,6 @@ import { UnitDef, BookletDef } from './test-controller.classes';
   providedIn: 'root'
 })
 export class TestControllerService {
-  // observed only by app.components for the page header
-  public pageTitle$ = new BehaviorSubject<string>('Lade Seite...');
-
   public booklet$ = new BehaviorSubject<BookletDef>(null);
   public currentUnitPos$ = new BehaviorSubject<number>(-1);
 
diff --git a/src/app/test-controller/unithost/unithost.component.css b/src/app/test-controller/unithost/unithost.component.css
index c0d476d8..ee147b56 100644
--- a/src/app/test-controller/unithost/unithost.component.css
+++ b/src/app/test-controller/unithost/unithost.component.css
@@ -1,12 +1,21 @@
 .unit-body {
   position: absolute;
   width: 100%;
-  top: 70px;
+  top: 40px;
   bottom: 45px;
   padding: 0px;
   background-color: white;
 }
 
+#unit-title {
+  width: 100%;
+  padding: 0px;
+  height: 40px;
+  font-size: 1.5em;
+  background-color: white;
+  border-bottom: solid 2px black;
+}
+
 #pageNav {
   position: absolute;
   width: 100%;
diff --git a/src/app/test-controller/unithost/unithost.component.html b/src/app/test-controller/unithost/unithost.component.html
index 97786f03..b6c3055b 100644
--- a/src/app/test-controller/unithost/unithost.component.html
+++ b/src/app/test-controller/unithost/unithost.component.html
@@ -1,6 +1,9 @@
 <div class="spinner-container" *ngIf="dataLoading">
     <mat-spinner></mat-spinner>
 </div>
+<div id="unit-title" fxLayoutAlign="center center">
+    {{ unitTitle }}
+</div>
 <div id="iFrameHost" iqbResizeIFrameChild class="unit-body">
     
 </div>
diff --git a/src/app/test-controller/unithost/unithost.component.ts b/src/app/test-controller/unithost/unithost.component.ts
index f1671c22..8b4711ce 100644
--- a/src/app/test-controller/unithost/unithost.component.ts
+++ b/src/app/test-controller/unithost/unithost.component.ts
@@ -28,6 +28,7 @@ export class UnithostComponent implements OnInit, OnDestroy {
 
   private myUnitNumber = -1;
   private myUnitName = '';
+  private unitTitle = '';
 
   // :::::::::::::::::::::
   private postMessageSubscription: Subscription = null;
@@ -257,7 +258,7 @@ export class UnithostComponent implements OnInit, OnDestroy {
     const booklet = this.tcs.booklet$.getValue();
     if ((currentUnitId >= 0) && (this.myUnitNumber === currentUnitId) && (booklet !== null)) {
       const currentUnit = booklet.getUnitAt(currentUnitId);
-      this.tcs.pageTitle$.next(currentUnit.label); // (currentUnitId + 1).toString() + '. '
+      this.unitTitle = currentUnit.label; // (currentUnitId + 1).toString() + '. '
       this.myUnitName = currentUnit.id;
 
       this.iFrameItemplayer = <HTMLIFrameElement>document.createElement('iframe');
diff --git a/src/index.html b/src/index.html
index eb294f55..c8289e5e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -2,7 +2,7 @@
 <html lang="en">
 <head>
   <meta charset="utf-8">
-  <title>IQBTestcenter</title>
+  <title>IQB-Testcenter</title>
   <base href="/">
 
   <meta name="viewport" content="width=device-width, initial-scale=1">
diff --git a/src/styles.css b/src/styles.css
index 9aa631cf..68f0965a 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -15,11 +15,6 @@
   width: 100%;
   top: 70px;
   bottom: 0;
-  /* display: flex;
-  flex-direction: row;
-  flex-wrap: nowrap;
-  align-items: flex-start;
-  justify-content: left; */
 }
 
 .sheetofpaper {
@@ -61,3 +56,21 @@ p.unitMessage {
   text-align: center;
 }
 
+.logo {
+  position: absolute;
+  left: 5px;
+  top: 5px;
+}
+
+div.logo img {
+  width: 100px;
+}
+
+.pagetitle {
+  position: absolute;
+  left: 100px;
+  top: 18px;
+  font-size: 1.5em;
+  color: white;
+}
+
-- 
GitLab