Skip to content
Snippets Groups Projects
Commit 30b249d3 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add ellipse function to content-list

parent cfc501d7
Branches
Tags
1 merge request!139Resolve "Various improvements"
This commit is part of merge request !139. Comments created here will be created in the context of that merge request.
...@@ -15,6 +15,7 @@ import { TranslateService } from '@ngx-translate/core'; ...@@ -15,6 +15,7 @@ import { TranslateService } from '@ngx-translate/core';
import { LanguageService } from '../../../services/util/language.service'; import { LanguageService } from '../../../services/util/language.service';
import { ContentDeleteComponent } from '../_dialogs/content-delete/content-delete.component'; import { ContentDeleteComponent } from '../_dialogs/content-delete/content-delete.component';
import { ContentEditComponent } from '../_dialogs/content-edit/content-edit.component'; import { ContentEditComponent } from '../_dialogs/content-edit/content-edit.component';
import { InnerSubscriber } from 'rxjs/internal/InnerSubscriber';
@Component({ @Component({
...@@ -42,6 +43,8 @@ export class ContentListComponent implements OnInit { ...@@ -42,6 +43,8 @@ export class ContentListComponent implements OnInit {
collectionName: string; collectionName: string;
labelMaxLength: number;
constructor(private contentService: ContentService, constructor(private contentService: ContentService,
private roomService: RoomService, private roomService: RoomService,
private route: ActivatedRoute, private route: ActivatedRoute,
...@@ -54,6 +57,7 @@ export class ContentListComponent implements OnInit { ...@@ -54,6 +57,7 @@ export class ContentListComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.labelMaxLength = innerWidth / 30;
this.roomId = localStorage.getItem(`roomId`); this.roomId = localStorage.getItem(`roomId`);
this.roomService.getRoom(this.roomId).subscribe(room => { this.roomService.getRoom(this.roomId).subscribe(room => {
this.room = room; this.room = room;
...@@ -62,6 +66,13 @@ export class ContentListComponent implements OnInit { ...@@ -62,6 +66,13 @@ export class ContentListComponent implements OnInit {
this.contentGroup = JSON.parse(sessionStorage.getItem('contentGroup')); this.contentGroup = JSON.parse(sessionStorage.getItem('contentGroup'));
this.contentService.getContentsByIds(this.contentGroup.contentIds).subscribe( contents => { this.contentService.getContentsByIds(this.contentGroup.contentIds).subscribe( contents => {
this.contents = contents; 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.route.params.subscribe(params => { this.route.params.subscribe(params => {
sessionStorage.setItem('collection', params['contentGroup']); sessionStorage.setItem('collection', params['contentGroup']);
......
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