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

Merge branch 'fix-alot-of-stuff' into 'master'

Fix alot of stuff

Closes #311, #306, and #300

See merge request !267
parents 1a4f4b0d 1f39d855
1 merge request!267Fix alot of stuff
Pipeline #27670 passed with stages
in 8 minutes and 2 seconds
<div *ngIf="editRoom">
<div mat-dialog-content *ngIf="editRoom">
<h2>{{'room-page.general' | translate }}</h2>
<mat-divider></mat-divider>
<div fxLayout="column">
......
......@@ -20,7 +20,7 @@
</button>
</div>
<mat-divider></mat-divider>
<mat-card-content fxLayoutAlign="center">
<mat-card-content *ngIf="room.description" fxLayoutAlign="center">
<h4>
{{ room.description.trim() }}
</h4>
......@@ -64,7 +64,7 @@
<app-content-groups *ngIf="room && room.contentGroups" [contentGroups]="room.contentGroups"></app-content-groups>
-->
</mat-card>
<div *ngIf="!isLoading && !room">Error: room could not be found!</div>
<div *ngIf="!isLoading && !room">{{ 'room-page.room-not-found' | translate }}</div>
</div>
</div>
......@@ -11,7 +11,7 @@
</mat-card-subtitle>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content fxLayoutAlign="center">
<mat-card-content *ngIf="room.description" fxLayoutAlign="center">
<h4>{{room.description.trim()}}</h4>
</mat-card-content>
<mat-grid-list cols="1" rowHeight="2:1">
......
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, HostListener, Inject } from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
import { DOCUMENT } from '@angular/common';
@Component({
selector: 'app-present-comment',
......@@ -9,8 +10,12 @@ import { TranslateService } from '@ngx-translate/core';
})
export class PresentCommentComponent implements OnInit {
public body: string;
// flag for fullscreen
private fs = false;
private ESCAPE_KEYCODE = 27;
constructor(
@Inject(DOCUMENT) private document: Document,
public dialogRef: MatDialogRef<PresentCommentComponent>,
private translateService: TranslateService,
public dialog: MatDialog
......@@ -18,6 +23,21 @@ export class PresentCommentComponent implements OnInit {
ngOnInit() {
this.translateService.use(localStorage.getItem('currentLang'));
/* if document is in fullscreen and user presses ESC, it doesn't trigger a keyup event */
this.document.addEventListener('fullscreenchange', () => {
if (this.fs && this.document.exitFullscreen) {
this.onCloseClick();
} else {
this.fs = true;
}
});
}
@HostListener('document:keyup', ['$event'])
onKeyUp(event: KeyboardEvent) {
if (event.keyCode === this.ESCAPE_KEYCODE) {
this.onCloseClick();
}
}
onCloseClick(): void {
......
......@@ -23,7 +23,7 @@ import { VoteService } from '../../../services/http/vote.service';
export class CommentListComponent implements OnInit {
@Input() user: User;
@Input() roomId: string;
comments: Comment[];
comments: Comment[] = [];
room: Room;
hideCommentsList = false;
filteredComments: Comment[];
......
......@@ -12,7 +12,7 @@
<span class="fill-remaining-space"
*ngIf="router.url.includes('comments') && user.role === 1 && deviceType === 'desktop'"></span>
<h3 *ngIf="router.url.includes('comments') && user.role === 1 && deviceType === 'desktop'" fxLayoutAlign="center center">
{{'header.id' | translate}}: {{ roomId.slice(0,4) }} {{ roomId.slice(4,8) }}
{{'header.id' | translate}}: {{ shortId.slice(0,4) }} {{ shortId.slice(4,8) }}
</h3>
<span class="fill-remaining-space"></span>
......
import { Component, OnInit } from '@angular/core';
import { AuthenticationService } from '../../../services/http/authentication.service';
import { NotificationService } from '../../../services/util/notification.service';
import { Router } from '@angular/router';
import { Router, NavigationEnd } from '@angular/router';
import { User } from '../../../models/user';
import { UserRole } from '../../../models/user-roles.enum';
import { Location } from '@angular/common';
......@@ -20,7 +20,7 @@ export class HeaderComponent implements OnInit {
user: User;
themeClass = localStorage.getItem('theme');
cTime: string;
roomId: string;
shortId: string;
deviceType = localStorage.getItem('deviceType');
constructor(public location: Location,
......@@ -44,18 +44,29 @@ export class HeaderComponent implements OnInit {
this.translationService.setDefaultLang(localStorage.getItem('currentLang'));
}
this.authenticationService.watchUser.subscribe(newUser => this.user = newUser);
this.getRoomId();
let time = new Date();
this.getTime(time);
setInterval(() => {
time = new Date();
this.getTime(time);
this.getRoomId();
}, 1000);
}
public getRoomId() {
this.roomId = localStorage.getItem('shortId');
this.router.events.subscribe(val => {
/* the router will fire multiple events */
/* we only want to react if it's the final active route */
if (val instanceof NavigationEnd) {
/* segments gets all parts of the url */
const segments = this.router.parseUrl(this.router.url).root.children.primary.segments;
const roomIdRegExp = new RegExp('^[0-9]{8}$');
segments.forEach(element => {
/* searches the url segments for a short id */
if (roomIdRegExp.test(element.path)) {
this.shortId = element.path;
}
});
}
});
}
getTime(time: Date) {
......
......@@ -28,7 +28,8 @@
"delete-all-comments": "Alle Kommentare löschen",
"really-delete-comments": "Wollen Sie wirklich alle Kommentare dieser Session löschen?",
"comments-deleted": "Alle Kommentare wurden gelöscht.",
"export-comments": "Kommentare exportieren"
"export-comments": "Kommentare exportieren",
"room-not-found": "Session wurde nicht gefunden :("
},
"content": {
"content": "Frage",
......
......@@ -28,7 +28,8 @@
"delete-all-comments": "Delete all comments",
"really-delete-comments": "Do you really want to delete all comments of this session?",
"comments-deleted": "All comments have been deleted.",
"export-comments": "Export comments"
"export-comments": "Export comments",
"room-not-found": "Session not found :("
},
"content": {
"content": "Content",
......
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