Skip to content
Snippets Groups Projects
Verified Commit 5f4bf650 authored by Lukas Maximilian Kimpel's avatar Lukas Maximilian Kimpel
Browse files

Make use of new components

Navigate to new content creation page when clicking on "Create new content"
Make ContentCreation component a component (not a MatDialog)
Add new routes to new pages
parent 0a56f6b7
No related merge requests found
...@@ -11,9 +11,10 @@ import { ParticipantRoomComponent } from './participant-room/participant-room.co ...@@ -11,9 +11,10 @@ import { ParticipantRoomComponent } from './participant-room/participant-room.co
import { CreatorRoomComponent } from './creator-room/creator-room.component'; import { CreatorRoomComponent } from './creator-room/creator-room.component';
import { CommentListComponent } from './comment-list/comment-list.component'; import { CommentListComponent } from './comment-list/comment-list.component';
import { ContentListComponent } from './content-list/content-list.component'; import { ContentListComponent } from './content-list/content-list.component';
import { ContentCreationComponent } from './content-creation/content-creation.component';
import { ContentDetailComponent } from './content-detail/content-detail.component'; import { ContentDetailComponent } from './content-detail/content-detail.component';
import { AnswerStatisticsComponent } from './answer-statistics/answer-statistics.component'; import { AnswerStatisticsComponent } from './answer-statistics/answer-statistics.component';
import { AddContentComponent } from './add-content/add-content.component';
import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' }, { path: '', redirectTo: '/home', pathMatch: 'full' },
...@@ -47,14 +48,14 @@ const routes: Routes = [ ...@@ -47,14 +48,14 @@ const routes: Routes = [
data: { roles: [UserRole.CREATOR] } data: { roles: [UserRole.CREATOR] }
}, },
{ {
path: 'creator/room/:roomId/answer-statistics', path: 'creator/room/:roomId/add-content',
component: AnswerStatisticsComponent, component: AddContentComponent,
canActivate: [AuthenticationGuard], canActivate: [AuthenticationGuard],
data: { roles: [UserRole.CREATOR] } data: { roles: [UserRole.CREATOR] }
}, },
{ {
path: 'creator/room/:roomId/content-creation', path: 'creator/room/:roomId/answer-statistics',
component: ContentCreationComponent, component: AnswerStatisticsComponent,
canActivate: [AuthenticationGuard], canActivate: [AuthenticationGuard],
data: { roles: [UserRole.CREATOR] } data: { roles: [UserRole.CREATOR] }
}, },
...@@ -70,7 +71,8 @@ const routes: Routes = [ ...@@ -70,7 +71,8 @@ const routes: Routes = [
canActivate: [AuthenticationGuard], canActivate: [AuthenticationGuard],
data: { roles: [UserRole.CREATOR] } data: { roles: [UserRole.CREATOR] }
}, },
{ path: 'participant/room/:roomId/create-comment', {
path: 'participant/room/:roomId/create-comment',
component: CreateCommentComponent, component: CreateCommentComponent,
canActivate: [AuthenticationGuard], canActivate: [AuthenticationGuard],
data: { roles: [UserRole.PARTICIPANT] } data: { roles: [UserRole.PARTICIPANT] }
......
...@@ -77,6 +77,9 @@ import { AnswerStatisticsComponent } from './answer-statistics/answer-statistics ...@@ -77,6 +77,9 @@ import { AnswerStatisticsComponent } from './answer-statistics/answer-statistics
import { RoomModificationComponent } from './room-modification/room-modification.component'; import { RoomModificationComponent } from './room-modification/room-modification.component';
import { ParticipantChoiceContentComponent } from './participant-choice-content/participant-choice-content.component'; import { ParticipantChoiceContentComponent } from './participant-choice-content/participant-choice-content.component';
import { CreatorChoiceContentComponent } from './creator-choice-content/creator-choice-content.component'; import { CreatorChoiceContentComponent } from './creator-choice-content/creator-choice-content.component';
import { AddContentComponent } from './add-content/add-content.component';
import { ParticipantContentCarouselPageComponent } from './participant-content-carousel-page/participant-content-carousel-page.component';
import { ParticipantTextContentComponent } from './participant-text-content/participant-text-content.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
...@@ -107,6 +110,9 @@ import { CreatorChoiceContentComponent } from './creator-choice-content/creator- ...@@ -107,6 +110,9 @@ import { CreatorChoiceContentComponent } from './creator-choice-content/creator-
RoomModificationComponent, RoomModificationComponent,
ParticipantChoiceContentComponent, ParticipantChoiceContentComponent,
CreatorChoiceContentComponent, CreatorChoiceContentComponent,
AddContentComponent,
ParticipantContentCarouselPageComponent,
ParticipantTextContentComponent,
AnswerStatisticsComponent AnswerStatisticsComponent
], ],
entryComponents: [ entryComponents: [
......
...@@ -19,13 +19,10 @@ export class ContentCreationComponent implements OnInit { ...@@ -19,13 +19,10 @@ export class ContentCreationComponent implements OnInit {
constructor(private contentService: ContentService, constructor(private contentService: ContentService,
private router: Router, private router: Router,
private notification: NotificationService, private notification: NotificationService) {
public dialogRef: MatDialogRef<RoomComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
} }
onNoClick(): void { onNoClick(): void {
this.dialogRef.close();
} }
ngOnInit() { ngOnInit() {
...@@ -45,8 +42,7 @@ export class ContentCreationComponent implements OnInit { ...@@ -45,8 +42,7 @@ export class ContentCreationComponent implements OnInit {
this.contentService.addContent({ subject: subject, body: body, roomId: this.roomId } as Content) this.contentService.addContent({ subject: subject, body: body, roomId: this.roomId } as Content)
.subscribe(content => { .subscribe(content => {
this.notification.show(`Content '${content.subject}' successfully created.`); this.notification.show(`Content '${content.subject}' successfully created.`);
this.router.navigate([`/creator/room/${content.roomId}/${content.contentId}`]); // this.router.navigate([`/creator/room/${content.roomId}/${content.contentId}`]);
this.dialogRef.close();
}); });
} }
} }
...@@ -21,7 +21,8 @@ ...@@ -21,7 +21,8 @@
<app-content-list></app-content-list> <app-content-list></app-content-list>
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-card-actions> <mat-card-actions>
<button mat-button color="primary" matTooltip="Create new content" (click)="createContentDialog()"> <button mat-button color="primary" matTooltip="Create new content"
routerLink="/creator/room/{{room.id}}/add-content">
Create content Create content
</button> </button>
<button mat-button color="primary" matTooltip="See room comments" routerLink="/creator/room/{{room.id}}/comments"> <button mat-button color="primary" matTooltip="See room comments" routerLink="/creator/room/{{room.id}}/comments">
......
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