diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.html b/src/app/components/participant/comment-create-page/comment-create-page.component.html index ee4cc4d166a10b0d823fc0054d16522a72c293ac..15f1a94f992f3905d07b32dbcfa26964dfd73334 100644 --- a/src/app/components/participant/comment-create-page/comment-create-page.component.html +++ b/src/app/components/participant/comment-create-page/comment-create-page.component.html @@ -4,12 +4,13 @@ <mat-form-field class="input-block"> <input matInput #commentSubject type="text" maxlength="25" placeholder="{{ 'comment-page.enter-title' | translate}}" onkeypress="return event.keyCode !=13;" - [formControl]="emptySubject"> - <mat-hint align="end" *ngIf="!emptyInputs">{{commentSubject.value.length}} / 25</mat-hint> + [formControl]="subjectForm"> + <mat-hint align="end">{{commentSubject.value.length}} / 25</mat-hint> </mat-form-field> <mat-form-field class="input-block"> - <textarea matInput #commentBody placeholder="{{ 'comment-page.enter-comment' | translate}}" matTextareaAutosize - matAutosizeMinRows=1 matAutosizeMaxRows=5 [formControl]="emptyBody"></textarea> + <textarea matInput #commentBody placeholder="{{ 'comment-page.enter-comment' | translate}}" + matAutosizeMinRows=2 matAutosizeMaxRows=5 maxlength="255" [formControl]="bodyForm"></textarea> + <mat-hint align="end">{{commentBody.value.length}} / 255</mat-hint> </mat-form-field> <button mat-raised-button color="accent" (click)="send(commentSubject.value, commentBody.value)">{{ 'comment-page.send' | translate}}</button> @@ -18,4 +19,4 @@ <div fxLayout="row" fxLayoutAlign="center"> <app-comment-list></app-comment-list> </div> -</div> \ No newline at end of file +</div> diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.scss b/src/app/components/participant/comment-create-page/comment-create-page.component.scss index ce244ec3c6b76073b139add2885197e286f63bf0..f057f5e761c53e634c0194d73993d6862a89cd9b 100644 --- a/src/app/components/participant/comment-create-page/comment-create-page.component.scss +++ b/src/app/components/participant/comment-create-page/comment-create-page.component.scss @@ -14,3 +14,7 @@ button { margin-right: 20px; min-width: 80px; } + +textarea { + line-height: 120%; +} diff --git a/src/app/components/participant/comment-create-page/comment-create-page.component.ts b/src/app/components/participant/comment-create-page/comment-create-page.component.ts index 048bc18010b8ba3eac342afa31fac4c78d078f8b..635758f1425390ca2f493b787fb681b543f85a2b 100644 --- a/src/app/components/participant/comment-create-page/comment-create-page.component.ts +++ b/src/app/components/participant/comment-create-page/comment-create-page.component.ts @@ -22,8 +22,9 @@ export class CommentCreatePageComponent implements OnInit { roomShortId: string; user: User; private date = new Date(Date.now()); - private emptySubject = new FormControl('', [Validators.required]); - private emptyBody = new FormControl('', [Validators.required]); + subjectForm = new FormControl('', [Validators.required]); + bodyForm = new FormControl('', [Validators.required]); + constructor( protected authenticationService: AuthenticationService, @@ -40,8 +41,6 @@ export class CommentCreatePageComponent implements OnInit { this.roomId = localStorage.getItem(`roomId`); } - // TODO: check if empty - send(subject: string, body: string): void { subject = subject.trim(); body = body.trim(); @@ -75,7 +74,6 @@ export class CommentCreatePageComponent implements OnInit { } as Comment).subscribe(() => { this.child.getComments(); this.notification.show(`Comment '${subject}' successfully created.`); - this.goBack(); }); }