[plugins-functionality | DONE | FIXED ] Criteria utils: allow short (3 criteria) or full version (for advanced criteria page)
This commit is contained in:
parent
30def2150b
commit
ba0bfeb356
|
@ -36,7 +36,7 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
|
||||||
<div *ngIf="!loading">
|
<div *ngIf="!loading">
|
||||||
<div *ngIf="selectionCriteria?.criteria?.length > 0" class="uk-margin-small-bottom">
|
<div *ngIf="selectionCriteria?.criteria?.length > 0" class="uk-margin-small-bottom">
|
||||||
<div class="uk-text-meta uk-margin-small-bottom">Criteria</div>
|
<div class="uk-text-meta uk-margin-small-bottom">Criteria</div>
|
||||||
<div [innerHTML]="criteriaUtils.getFiltersAsText(selectionCriteria.criteria)"></div>
|
<div [innerHTML]="criteriaUtils.getFiltersAsText(selectionCriteria.criteria,false)"></div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="selectionCriteria?.criteria?.length === 0" class="message">
|
<div *ngIf="selectionCriteria?.criteria?.length === 0" class="message">
|
||||||
<h5 class="uk-margin-small-bottom">No criteria yet</h5>
|
<h5 class="uk-margin-small-bottom">No criteria yet</h5>
|
||||||
|
|
|
@ -28,8 +28,8 @@ export class CriteriaUtils {
|
||||||
{value: 'greater_than', label: 'greater than'}
|
{value: 'greater_than', label: 'greater than'}
|
||||||
]
|
]
|
||||||
|
|
||||||
public getFiltersAsText(criteria: Criteria[]): string {
|
public getFiltersAsText(criteria: Criteria[], shortVersion=true): string {
|
||||||
let text = criteria.slice(0, 3).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => {
|
let text = criteria.slice(0, shortVersion?3:criteria.length).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => {
|
||||||
let field = this.fields.find(field => field.value === constraint.field)?.label;
|
let field = this.fields.find(field => field.value === constraint.field)?.label;
|
||||||
let matchCase = false;
|
let matchCase = false;
|
||||||
if (!constraint.verb.includes('_caseinsensitive')) {
|
if (!constraint.verb.includes('_caseinsensitive')) {
|
||||||
|
|
Loading…
Reference in New Issue