[Library|Trunk]

NewSearchPage Component - Custom filter:
	add custom filter in selected filters if not hidden and there in not in the refine fields
	use parameter cf=true to enable the filter




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59093 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-07-13 15:23:20 +00:00
parent 0c31508f7a
commit 8b0554bfd2
2 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,13 @@
<ng-template #selected_filters_pills>
<div class="uk-grid uk-grid-small uk-text-small" uk-grid>
<ng-container *ngIf="customFilterEnabled && customFilter && refineFields.indexOf(customFilter.queryFieldName) ==
-1 ">
<span>
<span class="selectedFilterLabel uk-disabled ">
<span class="">{{customFilter.valueName}}</span>
</span>
</span>
</ng-container>
<ng-container *ngIf="selectedTypesNum > 0 && resultTypes">
<ng-container *ngFor="let type of resultTypeOptions; let i = index; let end = last; ">
<ng-container *ngIf="resultTypes[type.id] == true">
@ -249,7 +257,9 @@
addClass=" " [breadcrumbs]="breadcrumbs"></breadcrumbs>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
[texts]="pageContents['top']"></helper>
<div [class]="(showRefine && !isDashboardView)? 'uk-width-4-5@m uk-width-4-5@l uk-width-1-1@s' :'uk-width-1-1'">
<div [class]="(showRefine && !this.properties.isDashboard)?
'uk-width-4-5@m uk-width-4-5@l uk-width-1-1@s'
:'uk-width-1-1'">
<div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m uk-margin-top">
<a href="#offcanvas-usage" uk-toggle>
@ -615,7 +625,7 @@
[class.switcher_active]="filterToggle">
<div id="style_switcher_toggle" (click)="filterToggle= !filterToggle">
<i class=" uk-text-muted">
<svg style="margin-top: 6px;" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24"
<svg style="margin-top: 8px;" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24"
viewBox="0 0 24 24"
fill="white" width="24px" height="24px">
<g>

View File

@ -107,6 +107,7 @@ export class NewSearchPageComponent {
//Dashboard
filterToggle = false;
customFilterEnabled:boolean = false;
constructor(private route: ActivatedRoute,
private location: Location,
private _meta: Meta,
@ -139,6 +140,7 @@ export class NewSearchPageComponent {
if (params['page'] && params['page']!=1) {
HelperFunctions.scrollToId("searchForm");
}
this.customFilterEnabled = params['cf'] && params['cf'] == "true";
});
var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.pageTitle;
@ -867,7 +869,8 @@ export class NewSearchPageComponent {
allFqs += fq;
}
}
if(this.customFilter && this.customFilter.isHiddenFilter){
this.customFilterEnabled = URLparams["cf"] == "true";
if(this.customFilter && (this.customFilter.isHiddenFilter || (this.refineFields.indexOf(this.customFilter.queryFieldName) == -1 && this.customFilterEnabled))){
allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
}
@ -1192,7 +1195,10 @@ public static createRangeFilterQuery(rangeField,selectedFromValue, selectedToVal
this.parameterValues.push("" + this.quickFilter.selected);
}
}
if(this.customFilterEnabled){
this.parameterNames.push("cf");
this.parameterValues.push("true");
}
// if (this.searchUtils.size != this.resultsPerPage) {
// // allLimits += ((allLimits.length == 0) ? '?' : '&') + 'size=' + this.searchUtils.size;
// this.parameterNames.push("size");