Commit 13bfc1ce authored by Klaus-Dieter Quibeldey-Cirkel's avatar Klaus-Dieter Quibeldey-Cirkel
Browse files

Merge branch 'staging' into 'master'

new filter for unanswered questions

See merge request arsnova/frag.jetzt!548
parents caa1c6f8 5cfef4fc
......@@ -175,6 +175,16 @@
<span [ngClass]="{answer: 'answered-icon'}[currentFilter]">{{ 'comment-list.filter-answered' | translate }}</span>
</button>
<button mat-menu-item
(focus)="hideCommentsList=true"
(click)="filterComments(unanswered)"
aria-labelledby="comment">
<mat-icon class="unanswered"
[ngClass]="{unanswered: 'unanswered-icon'}[currentFilter]">comment
</mat-icon>
<span [ngClass]="{unanswered: 'unanswered-icon'}[currentFilter]">{{ 'comment-list.filter-unanswered' | translate }}</span>
</button>
<button mat-menu-item
(focus)="hideCommentsList=true"
(click)="filterComments(owner)"
......
......@@ -127,6 +127,10 @@ app-comment {
color: var(--primary);
}
.unanswered-icon {
color: slategray;
}
.favorite-icon {
color: var(--yellow);
}
......
......@@ -31,13 +31,13 @@ import { BonusTokenService } from '../../../services/http/bonus-token.service';
import { ModeratorService } from '../../../services/http/moderator.service';
export enum Period {
FROMNOW = 'from-now',
ONEHOUR = 'time-1h',
FROMNOW = 'from-now',
ONEHOUR = 'time-1h',
THREEHOURS = 'time-3h',
ONEDAY = 'time-1d',
ONEWEEK = 'time-1w',
TWOWEEKS = 'time-2w',
ALL = 'time-all'
ONEDAY = 'time-1d',
ONEWEEK = 'time-1w',
TWOWEEKS = 'time-2w',
ALL = 'time-all'
}
@Component({
......@@ -77,6 +77,7 @@ export class CommentListComponent implements OnInit, OnDestroy {
tag = 'tag';
userNumber = 'userNumber';
answer = 'answer';
unanswered = 'unanswered';
owner = 'owner';
currentFilter = '';
commentVoteMap = new Map<string, Vote>();
......@@ -114,7 +115,7 @@ export class CommentListComponent implements OnInit, OnDestroy {
private titleService: TitleService,
private translationService: TranslateService,
private bonusTokenService: BonusTokenService,
private moderatorService: ModeratorService
private moderatorService: ModeratorService,
) {
langService.langEmitter.subscribe(lang => translateService.use(lang));
}
......@@ -125,14 +126,14 @@ export class CommentListComponent implements OnInit, OnDestroy {
nav('createQuestion', () => this.openCreateDialog());
nav('moderator', () => {
const dialogRef = this.dialog.open(ModeratorsComponent, {
width: '400px'
width: '400px',
});
dialogRef.componentInstance.roomId = this.room.id;
});
nav('tags', () => {
const updRoom = JSON.parse(JSON.stringify(this.room));
const dialogRef = this.dialog.open(TagsComponent, {
width: '400px'
width: '400px',
});
let tags = [];
if (this.room.tags !== undefined) {
......@@ -140,40 +141,40 @@ export class CommentListComponent implements OnInit, OnDestroy {
}
dialogRef.componentInstance.tags = tags;
dialogRef.afterClosed()
.subscribe(result => {
if (!result || result === 'abort') {
return;
} else {
updRoom.tags = result;
this.roomService.updateRoom(updRoom)
.subscribe((room) => {
this.room = room;
this.translateService.get('room-page.changes-successful').subscribe(msg => {
this.notificationService.show(msg);
});
},
error => {
this.translateService.get('room-page.changes-gone-wrong').subscribe(msg => {
this.notificationService.show(msg);
});
});
}
});
.subscribe(result => {
if (!result || result === 'abort') {
return;
} else {
updRoom.tags = result;
this.roomService.updateRoom(updRoom)
.subscribe((room) => {
this.room = room;
this.translateService.get('room-page.changes-successful').subscribe(msg => {
this.notificationService.show(msg);
});
},
error => {
this.translateService.get('room-page.changes-gone-wrong').subscribe(msg => {
this.notificationService.show(msg);
});
});
}
});
});
nav('deleteQuestions', () => {
const dialogRef = this.dialog.open(DeleteCommentsComponent, {
width: '400px'
width: '400px',
});
dialogRef.componentInstance.roomId = this.roomId;
dialogRef.afterClosed()
.subscribe(result => {
if (result === 'delete') {
this.translationService.get('room-page.comments-deleted').subscribe(msg => {
this.notificationService.show(msg);
});
this.commentService.deleteCommentsByRoomId(this.roomId).subscribe();
}
});
.subscribe(result => {
if (result === 'delete') {
this.translationService.get('room-page.comments-deleted').subscribe(msg => {
this.notificationService.show(msg);
});
this.commentService.deleteCommentsByRoomId(this.roomId).subscribe();
}
});
});
nav('exportQuestions', () => {
const exp: Export = new Export(
......@@ -231,7 +232,7 @@ export class CommentListComponent implements OnInit, OnDestroy {
if (this.userRole === UserRole.PARTICIPANT) {
this.openCreateDialog();
}
*/
*/
});
});
});
......@@ -491,13 +492,15 @@ export class CommentListComponent implements OnInit, OnDestroy {
return c.userNumber === compare;
case this.answer:
return c.answer;
case this.unanswered:
return !c.answer;
case this.owner:
return c.creatorId === this.user.id;
case this.moderator:
return c.creatorId === this.user.id && (this.user.role === 2 || this.user.role === 1);
case this.lecturer:
return c.creatorId === this.user.id && this.user.role === 3;
}
}
});
this.hideCommentsList = true;
this.sortComments(this.currentSort);
......@@ -629,7 +632,7 @@ export class CommentListComponent implements OnInit, OnDestroy {
}
this.commentsFilteredByTime = this.comments
.filter(c => new Date(c.timestamp).getTime() >=
(this.period === Period.FROMNOW ? this.fromNow : (currentTime.getTime() - periodInSeconds)));
(this.period === Period.FROMNOW ? this.fromNow : (currentTime.getTime() - periodInSeconds)));
} else {
this.commentsFilteredByTime = this.comments;
}
......
......@@ -37,6 +37,7 @@
"correct": "Als richtig markierte Fragen",
"favorite": "Ausgezeichnete Fragen",
"filter-answered": "Beantwortete Fragen",
"filter-unanswered": "Unbeantwortete Fragen",
"filter-comments": "Fragen filtern",
"filter-correct": "Bejahte Fragen",
"filter-favorite": "Vorgemerkt für Bonus",
......
......@@ -37,6 +37,7 @@
"correct": "Marked as correct",
"favorite": "Bonus question",
"filter-answered": "Answered questions",
"filter-unanswered": "Unanswered questions",
"filter-comments": "Filter questions",
"filter-correct": "Affirmed questions",
"filter-favorite": "Earmarked for bonus",
......
......@@ -29,7 +29,7 @@
"add-comment": "Stell deine Frage!",
"pause-comments": "Friert die Anzeige ein, um die Fragen in Ruhe zu lesen. Fragen können weiterhin gestellt und bewertet werden. Die Anzeige aktualisiert sich wieder durch Klicken des Buttons.",
"play-comments": "Neue Fragen und Bewertungen wieder anzeigen",
"comment-got-favorited": "Eine Frage von dir wurde favorisiert!",
"comment-got-favorited": "Hey, du hast einen Stern für eine gute Frage bekommen!",
"comment-stream-stopped": "Der Fragen-Strom wurde gestoppt.",
"comment-stream-started": "Der Fragen-Strom wurde gestartet.",
"comment-sent": "Die Frage wurde veröffentlicht.",
......@@ -38,6 +38,7 @@
"correct": "Bejaht",
"favorite": "Bonus-Frage",
"filter-answered": "Beantwortete Fragen",
"filter-unanswered": "Unbeantwortete Fragen",
"filter-comments": "Fragen filtern",
"filter-correct": "Bejahte Fragen",
"filter-favorite": "Vorgemerkt für Bonus",
......
......@@ -39,7 +39,7 @@
"add-comment": "Ask a question!",
"pause-comments": "Freezes the display to read the questions at rest. Questions can still be asked and scored. The display is only updated again by clicking the button.",
"play-comments": "Start the question stream",
"comment-got-favorited": "A question of yours was noted as very good!",
"comment-got-favorited": "Hey, you got a star for a good question!",
"comment-stream-stopped": "Question stream has been stopped.",
"comment-stream-started": "Question stream has been started.",
"comment-sent": "The question has been published.",
......@@ -48,6 +48,7 @@
"correct": "Marked as correct",
"favorite": "Bonus question",
"filter-answered": "Answered questions",
"filter-unanswered": "Unanswered questions",
"filter-comments": "Filter questions",
"filter-correct": "Affirmed questions",
"filter-favorite": "Earmarked for bonus",
......
Markdown is supported
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