From bfaecac914f86b28aa13e305ace000ac6206a890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Mau=C3=9F?= <lukas.mauss@mni.thm.de> Date: Mon, 4 Mar 2019 03:27:11 +0100 Subject: [PATCH] Fix ellipse update problems --- .../creator/content-list/content-list.component.html | 4 ++-- .../creator/content-list/content-list.component.ts | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/components/creator/content-list/content-list.component.html b/src/app/components/creator/content-list/content-list.component.html index b82d330ac..4c0649056 100644 --- a/src/app/components/creator/content-list/content-list.component.html +++ b/src/app/components/creator/content-list/content-list.component.html @@ -34,10 +34,10 @@ </mat-grid-list> <mat-divider></mat-divider> <mat-card-content> - <mat-expansion-panel *ngFor="let content of contents"> + <mat-expansion-panel *ngFor="let content of contents; index as i"> <mat-expansion-panel-header> <mat-panel-title> - {{ content.subject }} + {{ labels[i] }} </mat-panel-title> <button mat-icon-button color="accent" (click)="editContent(content);$event.stopPropagation();" class="editButton"> diff --git a/src/app/components/creator/content-list/content-list.component.ts b/src/app/components/creator/content-list/content-list.component.ts index c483d4e66..45efdade4 100644 --- a/src/app/components/creator/content-list/content-list.component.ts +++ b/src/app/components/creator/content-list/content-list.component.ts @@ -45,6 +45,8 @@ export class ContentListComponent implements OnInit { labelMaxLength: number; + labels: string[] = []; + constructor(private contentService: ContentService, private roomService: RoomService, private route: ActivatedRoute, @@ -68,8 +70,9 @@ export class ContentListComponent implements OnInit { this.contents = contents; for (let i = 0; i < this.contents.length; i++) { if (this.contents[i].subject.length > this.labelMaxLength) { - this.contents[i].subject = this.contents[i].subject.substr(0, this.labelMaxLength) + '..'; - console.log(this.contents); + this.labels[i] = this.contents[i].subject.substr(0, this.labelMaxLength) + '..'; + } else { + this.labels[i] = this.contents[i].subject; } } @@ -172,6 +175,7 @@ export class ContentListComponent implements OnInit { break; case 'update': this.contents[index] = this.contentCBackup; + this.contentService.updateContent(this.contents[index]).subscribe(); this.translateService.get('content.content-updated').subscribe(message => { this.notificationService.show(message); }); -- GitLab