From e07891e4fa5b2d07040f7b5de8331632c46beda1 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 12 May 2023 18:52:13 +0300 Subject: [PATCH] [Library | explore-redesign]: Moved to the left as filter and re-arranged the order of the filters. 1. searchFields.ts: a. Added in HIDDEN_FIELDS, "instancetypename" (refine filter for research products). b. In DEPENDENT_FIELDS, set ["instancetypename"]: "type" 2. quick-selections.component.ts: Added again (as in the past), @Input() vertical: boolean=false and show types using if vertical is true. 3. searchAll.component.html: Changed medium top and bottom margins to uk-margin-top uk-margin-bottom. 4. newSearchPage.component.ts: a. In method "getFields()", check for HIDDEN_FIELDS, also dependencies to resultTypes. b. Added method "getFilterById()". 5. newSearchPage.component.html: a. Moved to the left as filter (removed "include" line). b. Added and re-arranged the order of the filters --- searchPages/find/searchAll.component.html | 2 +- .../searchUtils/newSearchPage.component.html | 67 +++++++++++++------ .../searchUtils/newSearchPage.component.ts | 10 ++- .../searchUtils/quick-selections.component.ts | 38 ++++++----- utils/properties/searchFields.ts | 5 +- 5 files changed, 82 insertions(+), 40 deletions(-) diff --git a/searchPages/find/searchAll.component.html b/searchPages/find/searchAll.component.html index e2480460..5bde81ca 100644 --- a/searchPages/find/searchAll.component.html +++ b/searchPages/find/searchAll.component.html @@ -27,7 +27,7 @@ -
+
diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index b0e333a2..acca3a2f 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -71,6 +71,15 @@
+ + + + +
@@ -91,24 +100,42 @@ Filters temporarily unavailable. Please try again later.
    -
  • - +
  • +
  • - -
  • - +
  • + + +
  • +
  • + +
  • + +
  • +
  • -
  • - + +
  • + + + + + +
  • +
    + +
  • + +
  • +
    +
  • +
@@ -199,11 +226,11 @@
-
- - -
+ + + + +
diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index dfda1d97..c2a4ae31 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -430,7 +430,9 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { var dependentTo = this.searchFieldsHelper.DEPENDENT_FIELDS[this.refineFields[i]]; //if filter is not marked as hidden OR it is hidden but it is dependent to a field that it IS selected - if (this.searchFieldsHelper.HIDDEN_FIELDS.indexOf(this.refineFields[i]) == -1 || (selected_filters.indexOf(dependentTo) != -1) || (selected_filters.indexOf(this.refineFields[i]) != -1)) { + if (this.searchFieldsHelper.HIDDEN_FIELDS.indexOf(this.refineFields[i]) == -1 + || (selected_filters.indexOf(dependentTo) != -1) || (selected_filters.indexOf(this.refineFields[i]) != -1) + || (this.resultTypes && this.resultTypes.filterId == dependentTo && this.resultTypes.countSelectedValues > 0)) { fields.push(this.refineFields[i]); } } @@ -1718,4 +1720,8 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { } return totalPages; } -} + + public getFilterById(filterId: string): Filter { + return this.filters.find(filter => filter.filterId == filterId); + } + } diff --git a/searchPages/searchUtils/quick-selections.component.ts b/searchPages/searchUtils/quick-selections.component.ts index ad1cfb97..97e83847 100644 --- a/searchPages/searchUtils/quick-selections.component.ts +++ b/searchPages/searchUtils/quick-selections.component.ts @@ -11,27 +11,35 @@ import {OpenaireEntities} from "../../utils/properties/searchFields"; @Component({ selector: 'quick-selections', template: ` -
- - {{quickFilter.value}} - -
-
-
Include:
-
-
- -
- - -
-
+
+
+ + {{quickFilter.value}} + +
+
+
Include:
+
+
+ +
+ + +
+
+
+ +
+ +
` }) export class QuickSelectionsComponent { + @Input() vertical: boolean=false; @Input() resultTypes:Filter; @Output() typeChange = new EventEmitter(); @Input() isDisabled; diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 3043e422..02183b1c 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -694,7 +694,7 @@ export class SearchFields { //add project field depending on funder public HIDDEN_FIELDS: string[] = ["fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id", - "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject"]; + "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relproject", "instancetypename"]; public DEPENDENT_FIELDS: { [key: string]: string } = { ["relproject"]: "relfunder", @@ -703,7 +703,8 @@ export class SearchFields { ["fundinglevel2_id"]: "fundinglevel1_id", ["relfundinglevel0_id"]: "relfunder", ["relfundinglevel1_id"]: "relfundinglevel0_id", - ["relfundinglevel2_id"]: "relfundinglevel1_id" + ["relfundinglevel2_id"]: "relfundinglevel1_id", + ["instancetypename"]: "type" };