sumarize description text on listings
This commit is contained in:
parent
eda508a65c
commit
cadb0fedb4
|
@ -2,7 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
|||
|
||||
@Pipe({ name: 'sumarizeText' })
|
||||
export class SumarizeTextPipe implements PipeTransform {
|
||||
transform(items: any[], limit: number) {
|
||||
transform(items: any[], limit: number = 50) {
|
||||
if (items.length > limit) {
|
||||
return `${items.slice(0, limit-3)}...`;
|
||||
} else { return items; }
|
||||
|
|
|
@ -29,6 +29,7 @@ import { DescriptionTemplateStatus } from '@app/core/common/enum/description-tem
|
|||
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status';
|
||||
import { SumarizeTextPipe } from '@app/core/pipes/sumarize-text.pipe';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -76,7 +77,8 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
public enumUtils: EnumUtils,
|
||||
private language: TranslateService,
|
||||
private dialog: MatDialog,
|
||||
private fileUtils: FileUtils
|
||||
private fileUtils: FileUtils,
|
||||
private sumarizeTextPipe: SumarizeTextPipe
|
||||
) {
|
||||
super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
|
||||
// Lookup setup
|
||||
|
@ -120,7 +122,8 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
{
|
||||
prop: nameof<DescriptionTemplate>(x => x.description),
|
||||
sortable: true,
|
||||
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.DESCRIPTION'
|
||||
languageName: 'DESCRIPTION-TEMPLATE-LISTING.FIELDS.DESCRIPTION',
|
||||
pipe: this.sumarizeTextPipe
|
||||
},
|
||||
{
|
||||
prop: nameof<DescriptionTemplate>(x => x.status),
|
||||
|
|
|
@ -3,6 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
|
|||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
import { Reference } from '@app/core/model/reference/reference';
|
||||
import { SumarizeTextPipe } from '@app/core/pipes/sumarize-text.pipe';
|
||||
import { ReferenceLookup } from '@app/core/query/reference.lookup';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
|
@ -62,7 +63,8 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
|
|||
private pipeService: PipeService,
|
||||
public enumUtils: EnumUtils,
|
||||
private language: TranslateService,
|
||||
private dialog: MatDialog
|
||||
private dialog: MatDialog,
|
||||
private sumarizeText: SumarizeTextPipe
|
||||
) {
|
||||
super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
|
||||
// Lookup setup
|
||||
|
@ -93,7 +95,8 @@ export class ReferenceListingComponent extends BaseListingComponent<Reference, R
|
|||
this.gridColumns.push(...[{
|
||||
prop: nameof<Reference>(x => x.label),
|
||||
sortable: true,
|
||||
languageName: 'REFERENCE-LISTING.FIELDS.LABEL'
|
||||
languageName: 'REFERENCE-LISTING.FIELDS.LABEL',
|
||||
pipe: this.sumarizeText
|
||||
},
|
||||
{
|
||||
prop: nameof<Reference>(x => x.source),
|
||||
|
|
Loading…
Reference in New Issue