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

Rename comment-create

Remove content-create
parent 7e4f0d5d
No related merge requests found
Showing
with 6 additions and 110 deletions
......@@ -3,7 +3,7 @@ import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from './components/pages/page-not-found/page-not-found.component';
import { LoginScreenComponent } from './components/pages/login-screen/login-screen.component';
import { CreatorHomeScreenComponent } from './components/pages/creator-home-screen/creator-home-screen.component';
import { CreateCommentComponent } from './components/pages/create-comment/create-comment.component';
import { CreateCommentComponent } from './components/pages/comment-create/comment-create.component';
import { ParticipantHomeScreenComponent } from './components/pages/participant-home-screen/participant-home-screen.component';
import { AuthenticationGuard } from './guards/authentication.guard';
import { UserRole } from './models/user-roles.enum';
......@@ -11,7 +11,6 @@ import { ParticipantRoomComponent } from './components/pages/participant-room/pa
import { CreatorRoomComponent } from './components/pages/creator-room/creator-room.component';
import { CommentListComponent } from './components/fragments/comment-list/comment-list.component';
import { ContentListComponent } from './components/fragments/content-list/content-list.component';
import { ContentDetailComponent } from './components/pages/content-detail/content-detail.component';
import { AnswerStatisticsComponent } from './components/fragments/statistics/statistics.component';
import { AddContentComponent } from './components/pages/content-create/content-create.component';
import {
......@@ -64,12 +63,6 @@ const routes: Routes = [
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.CREATOR] }
},
{
path: 'creator/room/:roomId/content/:contentId',
component: ContentDetailComponent,
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.CREATOR] }
},
{
path: 'participant',
component: ParticipantHomeScreenComponent,
......@@ -83,7 +76,7 @@ const routes: Routes = [
data: { roles: [UserRole.PARTICIPANT] }
},
{
path: 'participant/room/:roomId/create-comment',
path: 'participant/room/:roomId/comment-create',
component: CreateCommentComponent,
canActivate: [AuthenticationGuard],
data: { roles: [UserRole.PARTICIPANT] }
......
......@@ -57,7 +57,7 @@ import { AuthenticationGuard } from './guards/authentication.guard';
import { RoomService } from './services/http/room.service';
import { RoomListComponent } from './components/fragments/room-list/room-list.component';
import { CreatorHomeScreenComponent } from './components/pages/creator-home-screen/creator-home-screen.component';
import { CreateCommentComponent } from './components/pages/create-comment/create-comment.component';
import { CreateCommentComponent } from './components/pages/comment-create/comment-create.component';
import { CommentService } from './services/http/comment.service';
import { ParticipantHomeScreenComponent } from './components/pages/participant-home-screen/participant-home-screen.component';
import { ParticipantRoomComponent } from './components/pages/participant-room/participant-room.component';
......
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateCommentComponent } from './create-comment.component';
import { CreateCommentComponent } from './comment-create.component';
describe('CreateCommentComponent', () => {
let component: CreateCommentComponent;
......
......@@ -12,8 +12,8 @@ import { CommentListComponent } from '../../fragments/comment-list/comment-list.
@Component({
selector: 'app-create-comment',
templateUrl: './create-comment.component.html',
styleUrls: ['./create-comment.component.scss']
templateUrl: './comment-create.component.html',
styleUrls: ['./comment-create.component.scss']
})
export class CreateCommentComponent implements OnInit {
@ViewChild(CommentListComponent) child: CommentListComponent;
......
......@@ -11,5 +11,4 @@ export class AddContentComponent implements OnInit {
ngOnInit() {
}
}
<div fxLayout="column" fxLayoutAlign="start" fxLayoutGap="20px" fxFill>
<div *ngIf="content" fxLayout="row" fxLayoutAlign="center">
<mat-card>
<mat-card-header>
<mat-card-title>
<h3 class="subheading-2">{{content.subject}}</h3>
</mat-card-title>
<mat-card-subtitle>ID: {{ content.contentId }}
<br> Round: {{ content.round }}</mat-card-subtitle>
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content>
<p>
{{ content.body }}
</p>
<mat-divider></mat-divider>
<div>
<app-content-answers-list></app-content-answers-list>
</div>
</mat-card-content>
<mat-divider></mat-divider>
<!-- answes list here -->
<mat-card-actions>
<button mat-button color="primary" matTooltip="Create new content" routerLink="/creator/room/{{content.contentId}}/content-creation">
Create answer
</button>
<button mat-button color="warn" matTooltip="Delete selected answer">
<!-- on click, add a 'x' on the right end of each answer to make it deletable -->
Delete answer
</button>
</mat-card-actions>
</mat-card>
</div>
</div>
mat-card {
max-width: 800px;
}
mat-card-content > :first-child {
margin-top: 16px;
}
\ No newline at end of file
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ContentDetailComponent } from './content-detail.component';
describe('ContentDetailComponent', () => {
let component: ContentDetailComponent;
let fixture: ComponentFixture<ContentDetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContentDetailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ContentDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
import { Content } from '../../../models/content';
import { ContentService } from '../../../services/http/content.service';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-content-detail',
templateUrl: './content-detail.component.html',
styleUrls: ['./content-detail.component.scss']
})
export class ContentDetailComponent implements OnInit {
content: Content = null;
constructor(
private contentService: ContentService,
private route: ActivatedRoute
) {}
ngOnInit() {
this.route.params.subscribe(params => {
this.getContent(params['contentId']);
});
}
getContent(contentId: string): void {
this.contentService.getContent(contentId)
.subscribe(content => this.content = content[0]);
}
}
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