From da1e799c9d29f27053784b816f37ce97fdb361b1 Mon Sep 17 00:00:00 2001 From: Heinrich Marks <heinrich.marks@mni.thm.de> Date: Mon, 12 Mar 2018 12:49:00 +0100 Subject: [PATCH] Resolve discussions --- src/app/answer-text.ts | 2 +- src/app/content-answer.service.ts | 6 ------ .../content-answers-list.component.html | 15 +++++++-------- .../content-answers-list.component.ts | 5 ++--- .../content-creation.component.scss | 2 +- .../content-detail/content-detail.component.html | 13 +++++++------ .../content-detail/content-detail.component.scss | 10 +++++----- src/app/content-list/content-list.component.ts | 4 ++-- src/app/content.service.ts | 5 ----- src/app/content.ts | 2 +- 10 files changed, 26 insertions(+), 38 deletions(-) diff --git a/src/app/answer-text.ts b/src/app/answer-text.ts index 14ad44172..b2014e2d8 100644 --- a/src/app/answer-text.ts +++ b/src/app/answer-text.ts @@ -1,7 +1,7 @@ export class AnswerText { id: string; revision: string; - contendId: string; + contentId: string; round: number; subject: string; body: string; diff --git a/src/app/content-answer.service.ts b/src/app/content-answer.service.ts index 7bbded131..e414d1d2a 100644 --- a/src/app/content-answer.service.ts +++ b/src/app/content-answer.service.ts @@ -4,14 +4,12 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { catchError, tap } from 'rxjs/operators'; import { ErrorHandlingService } from './error-handling.service'; - const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; @Injectable() export class ContentAnswerService extends ErrorHandlingService { - private answerUrl = 'api/answerTexts'; constructor(private http: HttpClient) { @@ -20,14 +18,12 @@ export class ContentAnswerService extends ErrorHandlingService { getAnswerTexts(): Observable<AnswerText[]> { return this.http.get<AnswerText[]>(this.answerUrl).pipe( - tap(_ => ''), catchError(this.handleError('getAnswerTexts', [])) ); } addAnswerText(answerText: AnswerText): Observable<AnswerText> { return this.http.post<AnswerText>(this.answerUrl, answerText, httpOptions).pipe( - tap(_ => ''), catchError(this.handleError<AnswerText>('addAnswerText')) ); } @@ -35,9 +31,7 @@ export class ContentAnswerService extends ErrorHandlingService { getAnswerText(id: string): Observable<AnswerText> { const url = `${this.answerUrl}/${id}`; return this.http.get<AnswerText>(url).pipe( - tap(_ => ''), catchError(this.handleError<AnswerText>(`getAnswerText id=${id}`)) ); } - } diff --git a/src/app/content-answers-list/content-answers-list.component.html b/src/app/content-answers-list/content-answers-list.component.html index 8c691ac46..d1205e828 100644 --- a/src/app/content-answers-list/content-answers-list.component.html +++ b/src/app/content-answers-list/content-answers-list.component.html @@ -1,9 +1,8 @@ <mat-list> - <h3 mat-subheader>Answers</h3> - <mat-list-item *ngFor="let textAnswer of textAnswers"> - <button mat-button routerLink="{{textAnswer.id}}"> - {{textAnswer.body}} - </button> - </mat-list-item> - </mat-list> - \ No newline at end of file + <h3 mat-subheader>Answers</h3> + <mat-list-item *ngFor="let textAnswer of textAnswers"> + <button mat-button routerLink="{{textAnswer.id}}"> + {{textAnswer.body}} + </button> + </mat-list-item> +</mat-list> \ No newline at end of file diff --git a/src/app/content-answers-list/content-answers-list.component.ts b/src/app/content-answers-list/content-answers-list.component.ts index 1b9efed7c..f12737a54 100644 --- a/src/app/content-answers-list/content-answers-list.component.ts +++ b/src/app/content-answers-list/content-answers-list.component.ts @@ -10,17 +10,16 @@ import { AnswerText } from '../answer-text'; export class ContentAnswersListComponent implements OnInit { textAnswers: AnswerText[]; - constructor(private ContentAnswerService: ContentAnswerService ) { } + constructor(private contentAnswerService: ContentAnswerService ) { } ngOnInit() { this.getAnswerTexts(); } getAnswerTexts(): void { - this.ContentAnswerService.getAnswerTexts(). + this.contentAnswerService.getAnswerTexts(). subscribe(textAnswers => { this.textAnswers = textAnswers; }) } - } diff --git a/src/app/content-creation/content-creation.component.scss b/src/app/content-creation/content-creation.component.scss index 4f268d8cd..ed6000348 100644 --- a/src/app/content-creation/content-creation.component.scss +++ b/src/app/content-creation/content-creation.component.scss @@ -1,4 +1,4 @@ .content-card { max-width: 400px; - margin: 5%; + margin: 10px; } diff --git a/src/app/content-detail/content-detail.component.html b/src/app/content-detail/content-detail.component.html index 1abb21f9a..92b0bc10d 100644 --- a/src/app/content-detail/content-detail.component.html +++ b/src/app/content-detail/content-detail.component.html @@ -5,7 +5,8 @@ <mat-card-title> <h3 class="subheading-2">{{content.subject}}</h3> </mat-card-title> - <mat-card-subtitle>ID: {{ content.id }} <br> Round: {{ content.round }}</mat-card-subtitle> + <mat-card-subtitle>ID: {{ content.id }} + <br> Round: {{ content.round }}</mat-card-subtitle> </mat-card-header> <mat-divider></mat-divider> <mat-card-content> @@ -19,15 +20,15 @@ </mat-card-content> <mat-divider></mat-divider> <!-- answes list here --> - <mat-card-actions> + <mat-card-actions> <button mat-button color="primary" matTooltip="Create new content" routerLink="/creator/room/{{content.id}}/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 --> + <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> + </mat-card-actions> + </mat-card> </div> </div> \ No newline at end of file diff --git a/src/app/content-detail/content-detail.component.scss b/src/app/content-detail/content-detail.component.scss index af7e42df3..78348d75e 100644 --- a/src/app/content-detail/content-detail.component.scss +++ b/src/app/content-detail/content-detail.component.scss @@ -1,8 +1,8 @@ mat-card { - max-width: 800px; - } + max-width: 800px; +} - mat-card-content > :first-child { - margin-top: 16px; - } +mat-card-content > :first-child { + margin-top: 16px; +} \ No newline at end of file diff --git a/src/app/content-list/content-list.component.ts b/src/app/content-list/content-list.component.ts index 71828d595..4fddce67c 100644 --- a/src/app/content-list/content-list.component.ts +++ b/src/app/content-list/content-list.component.ts @@ -10,14 +10,14 @@ import { Content } from '../content'; export class ContentListComponent implements OnInit { contents: Content[]; - constructor(private ContentService: ContentService) { } + constructor(private contentService: ContentService) { } ngOnInit() { this.getContents(); } getContents(): void { - this.ContentService.getContents() + this.contentService.getContents() .subscribe(contents => { this.contents = contents; }); diff --git a/src/app/content.service.ts b/src/app/content.service.ts index 438e9f5e9..c6ae7385d 100644 --- a/src/app/content.service.ts +++ b/src/app/content.service.ts @@ -4,7 +4,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { catchError, tap } from 'rxjs/operators'; import { ErrorHandlingService } from './error-handling.service'; - const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) }; @@ -20,14 +19,12 @@ export class ContentService extends ErrorHandlingService { getContents(): Observable<Content[]> { return this.http.get<Content[]>(this.contentUrl).pipe( - tap(_ => ''), catchError(this.handleError('getContents', [])) ); } addContent(content: Content): Observable<Content> { return this.http.post<Content>(this.contentUrl, content, httpOptions).pipe( - tap(_ => ''), catchError(this.handleError<Content>('addContent')) ); } @@ -35,9 +32,7 @@ export class ContentService extends ErrorHandlingService { getContent(id: string): Observable<Content> { const url = `${this.contentUrl}/${id}`; return this.http.get<Content>(url).pipe( - tap(_ => ''), catchError(this.handleError<Content>(`getContent id=${id}`)) ); } - } diff --git a/src/app/content.ts b/src/app/content.ts index 8ed673db7..f8069e811 100644 --- a/src/app/content.ts +++ b/src/app/content.ts @@ -15,5 +15,5 @@ export class Content { body: string; round: number; format: Format; - // formatAttributes: Map<string, string>; + formatAttributes: Map<string, string>; } -- GitLab