From 21e530a70f82cf874ffb0b0a78b34cc0917685dc Mon Sep 17 00:00:00 2001 From: Sebastian Wittek <sebastian.wittek@mni.thm.de> Date: Tue, 19 Mar 2019 13:32:39 +0100 Subject: [PATCH] outsource comment-page --- .../comment-creator-page.component.html | 4 +-- .../comment-participant-page.component.html | 1 + .../comment-participant-page.component.scss | 0 ...comment-participant-page.component.spec.ts | 27 +++++++++++++++++++ .../comment-participant-page.component.ts | 15 +++++++++++ .../participant/participant-routing.module.ts | 6 ++--- .../participant/participant.module.ts | 7 ++--- .../room-participant-page.component.html | 2 +- .../submit-comment.component.html | 0 .../submit-comment.component.scss | 0 .../submit-comment.component.spec.ts | 2 ++ .../submit-comment.component.ts | 4 +-- .../comment-page/comment-page.component.html} | 0 .../comment-page/comment-page.component.scss} | 0 .../comment-page.component.spec.ts} | 12 ++++----- .../comment-page/comment-page.component.ts} | 12 ++++----- src/app/components/shared/shared.module.ts | 16 ++++++----- 17 files changed, 76 insertions(+), 32 deletions(-) create mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.html create mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.scss create mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts create mode 100644 src/app/components/participant/comment-participant-page/comment-participant-page.component.ts rename src/app/components/{participant/_diaglogs => shared/_dialogs}/submit-comment/submit-comment.component.html (100%) rename src/app/components/{participant/_diaglogs => shared/_dialogs}/submit-comment/submit-comment.component.scss (100%) rename src/app/components/{participant/_diaglogs => shared/_dialogs}/submit-comment/submit-comment.component.spec.ts (99%) rename src/app/components/{participant/_diaglogs => shared/_dialogs}/submit-comment/submit-comment.component.ts (87%) rename src/app/components/{participant/comment-create-page/comment-create-page.component.html => shared/comment-page/comment-page.component.html} (100%) rename src/app/components/{participant/comment-create-page/comment-create-page.component.scss => shared/comment-page/comment-page.component.scss} (100%) rename src/app/components/{participant/comment-create-page/comment-create-page.component.spec.ts => shared/comment-page/comment-page.component.spec.ts} (51%) rename src/app/components/{participant/comment-create-page/comment-create-page.component.ts => shared/comment-page/comment-page.component.ts} (89%) diff --git a/src/app/components/creator/comment-creator-page/comment-creator-page.component.html b/src/app/components/creator/comment-creator-page/comment-creator-page.component.html index cb304da36..2445a6fca 100644 --- a/src/app/components/creator/comment-creator-page/comment-creator-page.component.html +++ b/src/app/components/creator/comment-creator-page/comment-creator-page.component.html @@ -1,3 +1 @@ -<div fxLayout="row" fxLayoutAlign="center"> - <app-comment-list></app-comment-list> -</div> +<app-comment-page></app-comment-page> diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.html b/src/app/components/participant/comment-participant-page/comment-participant-page.component.html new file mode 100644 index 000000000..2445a6fca --- /dev/null +++ b/src/app/components/participant/comment-participant-page/comment-participant-page.component.html @@ -0,0 +1 @@ +<app-comment-page></app-comment-page> diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.scss b/src/app/components/participant/comment-participant-page/comment-participant-page.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts b/src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts new file mode 100644 index 000000000..6287f88a1 --- /dev/null +++ b/src/app/components/participant/comment-participant-page/comment-participant-page.component.spec.ts @@ -0,0 +1,27 @@ +/* +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CommentParticipantPageComponent } from './comment-participant-page.component'; + +describe('CommentParticipantPageComponent', () => { + let component: CommentParticipantPageComponent; + let fixture: ComponentFixture<CommentParticipantPageComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CommentParticipantPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CommentParticipantPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); +*/ diff --git a/src/app/components/participant/comment-participant-page/comment-participant-page.component.ts b/src/app/components/participant/comment-participant-page/comment-participant-page.component.ts new file mode 100644 index 000000000..e652a59ef --- /dev/null +++ b/src/app/components/participant/comment-participant-page/comment-participant-page.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-comment-participant-page', + templateUrl: './comment-participant-page.component.html', + styleUrls: ['./comment-participant-page.component.scss'] +}) +export class CommentParticipantPageComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/components/participant/participant-routing.module.ts b/src/app/components/participant/participant-routing.module.ts index b4b33c4e5..1b6054cae 100644 --- a/src/app/components/participant/participant-routing.module.ts +++ b/src/app/components/participant/participant-routing.module.ts @@ -4,11 +4,11 @@ import { HomeParticipantPageComponent } from './home-participant-page/home-parti import { AuthenticationGuard } from '../../guards/authentication.guard'; import { UserRole } from '../../models/user-roles.enum'; import { RoomParticipantPageComponent } from './room-participant-page/room-participant-page.component'; -import { CommentCreatePageComponent } from './comment-create-page/comment-create-page.component'; import { FeedbackBarometerPageComponent } from '../shared/feedback-barometer-page/feedback-barometer-page.component'; import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component'; import { StatisticsPageComponent } from '../shared/statistics-page/statistics-page.component'; import { StatisticComponent } from '../shared/statistic/statistic.component'; +import { CommentParticipantPageComponent } from './comment-participant-page/comment-participant-page.component'; const routes: Routes = [ { @@ -36,8 +36,8 @@ const routes: Routes = [ data: { roles: [UserRole.PARTICIPANT] } }, { - path: 'room/:roomId/create-comment', - component: CommentCreatePageComponent, + path: 'room/:roomId/comments', + component: CommentParticipantPageComponent, canActivate: [AuthenticationGuard], data: { roles: [UserRole.PARTICIPANT] } }, diff --git a/src/app/components/participant/participant.module.ts b/src/app/components/participant/participant.module.ts index 761eb7136..640952e86 100644 --- a/src/app/components/participant/participant.module.ts +++ b/src/app/components/participant/participant.module.ts @@ -11,7 +11,7 @@ import { ParticipantContentCarouselPageComponent } from './participant-content-c import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { HttpClient } from '@angular/common/http'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; -import { SubmitCommentComponent } from './_diaglogs/submit-comment/submit-comment.component'; +import { CommentParticipantPageComponent } from './comment-participant-page/comment-participant-page.component'; @NgModule({ imports: [ @@ -34,10 +34,7 @@ import { SubmitCommentComponent } from './_diaglogs/submit-comment/submit-commen HomeParticipantPageComponent, RoomParticipantPageComponent, ParticipantContentCarouselPageComponent, - SubmitCommentComponent - ], - entryComponents: [ - SubmitCommentComponent + CommentParticipantPageComponent ] }) export class ParticipantModule { diff --git a/src/app/components/participant/room-participant-page/room-participant-page.component.html b/src/app/components/participant/room-participant-page/room-participant-page.component.html index c361e9994..796d69a13 100644 --- a/src/app/components/participant/room-participant-page/room-participant-page.component.html +++ b/src/app/components/participant/room-participant-page/room-participant-page.component.html @@ -24,7 +24,7 @@ <mat-grid-list cols="3" rowHeight="2:1"> <mat-grid-tile> <button mat-icon-button color="primary" matTooltip="{{ 'room-page.create-comment' | translate}}" - routerLink="/participant/room/{{ room.id }}/create-comment"> + routerLink="/participant/room/{{ room.id }}/comments"> <mat-icon>question_answer</mat-icon> </button> </mat-grid-tile> diff --git a/src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.html b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.html similarity index 100% rename from src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.html rename to src/app/components/shared/_dialogs/submit-comment/submit-comment.component.html diff --git a/src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.scss b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.scss similarity index 100% rename from src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.scss rename to src/app/components/shared/_dialogs/submit-comment/submit-comment.component.scss diff --git a/src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.spec.ts b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.spec.ts similarity index 99% rename from src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.spec.ts rename to src/app/components/shared/_dialogs/submit-comment/submit-comment.component.spec.ts index 0b5da7180..730881f3d 100644 --- a/src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.spec.ts +++ b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.spec.ts @@ -1,3 +1,4 @@ +/* import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { SubmitCommentComponent } from './submit-comment.component'; @@ -23,3 +24,4 @@ describe('SubmitCommentComponent', () => { expect(component).toBeTruthy(); }); }); +*/ diff --git a/src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.ts b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts similarity index 87% rename from src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.ts rename to src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts index 856026453..1c6179372 100644 --- a/src/app/components/participant/_diaglogs/submit-comment/submit-comment.component.ts +++ b/src/app/components/shared/_dialogs/submit-comment/submit-comment.component.ts @@ -4,7 +4,7 @@ import { Router } from '@angular/router'; import { NotificationService } from '../../../../services/util/notification.service'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material'; import { TranslateService } from '@ngx-translate/core'; -import { CommentCreatePageComponent } from '../../comment-create-page/comment-create-page.component'; +import { CommentPageComponent } from '../../comment-page/comment-page.component'; import { AuthenticationService } from '../../../../services/http/authentication.service'; @@ -19,7 +19,7 @@ export class SubmitCommentComponent implements OnInit { constructor(private router: Router, private notification: NotificationService, - public dialogRef: MatDialogRef<CommentCreatePageComponent>, + public dialogRef: MatDialogRef<CommentPageComponent>, private translateService: TranslateService, protected authenticationService: AuthenticationService, public dialog: MatDialog, diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.html b/src/app/components/shared/comment-page/comment-page.component.html similarity index 100% rename from src/app/components/participant/comment-create-page/comment-create-page.component.html rename to src/app/components/shared/comment-page/comment-page.component.html diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.scss b/src/app/components/shared/comment-page/comment-page.component.scss similarity index 100% rename from src/app/components/participant/comment-create-page/comment-create-page.component.scss rename to src/app/components/shared/comment-page/comment-page.component.scss diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.spec.ts b/src/app/components/shared/comment-page/comment-page.component.spec.ts similarity index 51% rename from src/app/components/participant/comment-create-page/comment-create-page.component.spec.ts rename to src/app/components/shared/comment-page/comment-page.component.spec.ts index 5db9a7cba..de9e0a549 100644 --- a/src/app/components/participant/comment-create-page/comment-create-page.component.spec.ts +++ b/src/app/components/shared/comment-page/comment-page.component.spec.ts @@ -1,20 +1,20 @@ /* import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { CommentCreatePageComponent } from './comment-create-page.component'; +import { CommentPageComponent } from './comment-page.component'; -describe('CommentCreatePageComponent', () => { - let component: CommentCreatePageComponent; - let fixture: ComponentFixture<CommentCreatePageComponent>; +describe('CommentPageComponent', () => { + let component: CommentPageComponent; + let fixture: ComponentFixture<CommentPageComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ CommentCreatePageComponent ] + declarations: [ CommentPageComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(CommentCreatePageComponent); + fixture = TestBed.createComponent(CommentPageComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.ts b/src/app/components/shared/comment-page/comment-page.component.ts similarity index 89% rename from src/app/components/participant/comment-create-page/comment-create-page.component.ts rename to src/app/components/shared/comment-page/comment-page.component.ts index d7bf0d24e..a33219351 100644 --- a/src/app/components/participant/comment-create-page/comment-create-page.component.ts +++ b/src/app/components/shared/comment-page/comment-page.component.ts @@ -7,16 +7,16 @@ import { CommentService } from '../../../services/http/comment.service'; import { NotificationService } from '../../../services/util/notification.service'; import { AuthenticationService } from '../../../services/http/authentication.service'; import { User } from '../../../models/user'; -import { CommentListComponent } from '../../shared/comment-list/comment-list.component'; +import { CommentListComponent } from '../comment-list/comment-list.component'; import { MatDialog } from '@angular/material'; -import { SubmitCommentComponent } from '../_diaglogs/submit-comment/submit-comment.component'; +import { SubmitCommentComponent } from '../_dialogs/submit-comment/submit-comment.component'; @Component({ - selector: 'app-comment-create-page', - templateUrl: './comment-create-page.component.html', - styleUrls: ['./comment-create-page.component.scss'] + selector: 'app-comment-page', + templateUrl: './comment-page.component.html', + styleUrls: ['./comment-page.component.scss'] }) -export class CommentCreatePageComponent implements OnInit { +export class CommentPageComponent implements OnInit { @ViewChild(CommentListComponent) child: CommentListComponent; roomId: string; roomShortId: string; diff --git a/src/app/components/shared/shared.module.ts b/src/app/components/shared/shared.module.ts index 7370a6511..4bb3e3c73 100644 --- a/src/app/components/shared/shared.module.ts +++ b/src/app/components/shared/shared.module.ts @@ -11,7 +11,7 @@ import { RoomPageComponent } from './room-page/room-page.component'; import { StatisticsPageComponent } from './statistics-page/statistics-page.component'; import { AnswerEditComponent } from '../creator/_dialogs/answer-edit/answer-edit.component'; import { ContentDeleteComponent } from '../creator/_dialogs/content-delete/content-delete.component'; -import { CommentCreatePageComponent } from '../participant/comment-create-page/comment-create-page.component'; +import { CommentPageComponent } from './comment-page/comment-page.component'; import { EssentialsModule } from '../essentials/essentials.module'; import { SharedRoutingModule } from './shared-routing.module'; import { ListStatisticComponent } from './list-statistic/list-statistic.component'; @@ -22,6 +22,7 @@ import { RoomCreateComponent } from './_dialogs/room-create/room-create.componen import { LoginComponent } from './login/login.component'; import { StatisticHelpComponent } from './_dialogs/statistic-help/statistic-help.component'; import { CommentComponent } from './comment/comment.component'; +import {SubmitCommentComponent} from "./_dialogs/submit-comment/submit-comment.component"; @NgModule({ imports: [ @@ -42,7 +43,7 @@ import { CommentComponent } from './comment/comment.component'; FeedbackBarometerPageComponent, FooterComponent, FeedbackBarometerPageComponent, - CommentCreatePageComponent, + CommentPageComponent, CommentListComponent, StatisticsPageComponent, ListStatisticComponent, @@ -50,7 +51,8 @@ import { CommentComponent } from './comment/comment.component'; RoomCreateComponent, LoginComponent, StatisticHelpComponent, - CommentComponent + CommentComponent, + SubmitCommentComponent ], exports: [ RoomJoinComponent, @@ -64,14 +66,16 @@ import { CommentComponent } from './comment/comment.component'; FeedbackBarometerPageComponent, FooterComponent, FeedbackBarometerPageComponent, - CommentCreatePageComponent, + CommentPageComponent, CommentListComponent, - StatisticsPageComponent + StatisticsPageComponent, + SubmitCommentComponent ], entryComponents: [ RoomCreateComponent, LoginComponent, - StatisticHelpComponent + StatisticHelpComponent, + SubmitCommentComponent ] }) export class SharedModule { -- GitLab