-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hotfix/field values #1708
Hotfix/field values #1708
Conversation
89da17b
to
bd4b170
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Good idea to declutter DocumentView
. Some questions/comments.
<ng-container *ngIf="field && document"> | ||
<ng-container *ngIf="document.highlight && document.highlight[field.name]; | ||
else unhighlightedRow"> | ||
<ng-container *ngFor="let highlight of document.highlight[field.name]; | ||
last as isLast"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of ngIf
and ngFor
here. I wonder if an elvis operator could cut some lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
E.g. something like *ngFor=let highlight of document?.highlight[field?.name]
Probably wishful thinking :)
else unhighlightedRow"> | ||
<ng-container *ngFor="let highlight of document.highlight[field.name]; | ||
last as isLast"> | ||
<div ngPreserveWhitespaces style="word-break:break-word" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor DRY
for the style
. Could make it a class.
@@ -0,0 +1,16 @@ | |||
<ng-container *ngIf="field" [ngSwitch]="field.displayType"> | |||
<div *ngSwitchCase="'text'" | |||
[innerHtml]="field | elasticsearchHighlight:document | paragraph"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is unclear to me. What is displayed as innerHtml
in which cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is displayed if the field has display type text
. (So it's tokenised as text, but not a text_content
field - usually a title or something.)
I think the elasticsearchHighlight
pipe adds the <mark>
tags for highlights, and paragraph
adds <p>
tags for paragraphs.
I agree with your comments here; this is the kind of stuff I'm talking about when I say I still want to clean up these components some more. I think I'll make an update for that soon; I'll try to address your suggestions there as well. |
Fixes #1705, #1706, #1709
This also creates two separate components for displaying fields, instead of writing that logic in the document-view and document-preview components, because I was getting lost in the templates of those components.
I've been meaning to clean up these components a bit and straighten out some minor inconsistencies. For now, this at least fixes the missing values.