Skip to content
Snippets Groups Projects
Commit 6e16ceb9 authored by Scott Berg's avatar Scott Berg
Browse files

Update req title pipe to concat all lines together and return one string.

parent f12f7943
No related branches found
No related tags found
No related merge requests found
......@@ -156,11 +156,7 @@
</ng-container>
</div>
<div>
<p>
<ng-container *ngFor="let line of (requirement | requirementTitle)">
<span [innerHTML]="line"></span>
</ng-container>
</p>
<p [innerHTML]="requirement | requirementTitle"></p>
</div>
</mat-panel-title>
</mat-expansion-panel-header>
......
......@@ -3,13 +3,18 @@ import { Requirement, ContentType } from '../models/audit/requirement';
@Pipe({ name: 'requirementTitle', pure: true })
export class RequirementTitlePipe implements PipeTransform {
transform(requirement: Requirement): string[] {
const title = requirement.requirementContents.find(
transform(requirement: Requirement): string {
// Get any title lines
const titleLines = requirement.requirementContents.filter(
(r): r is ContentType =>
r.contentType === 'okRequirementTitle' ||
r.contentType === 'hText' ||
r.contentType === 'noRequirementTitle',
);
return title ? title.lines : ['No title found'];
// Concat all the lines together, removing whitespace
return titleLines.reduce((acc, { lines }) => {
return `${acc} ${lines.join(' ')}`.trim();
}, '');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment