Project

General

Profile

« Previous | Next » 

Revision 59093

[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

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
1 1
<ng-template #selected_filters_pills>
2 2
  <div class="uk-grid uk-grid-small uk-text-small" uk-grid>
3
    <ng-container *ngIf="customFilterEnabled && customFilter && refineFields.indexOf(customFilter.queryFieldName) ==
4
    -1 ">
5
     <span>
6
        <span class="selectedFilterLabel uk-disabled ">
7
            <span class="">{{customFilter.valueName}}</span>
8
        </span>
9
      </span>
10
    </ng-container>
3 11
    <ng-container *ngIf="selectedTypesNum > 0 && resultTypes">
4 12
      <ng-container *ngFor="let type of resultTypeOptions; let i = index;  let end = last; ">
5 13
        <ng-container *ngIf="resultTypes[type.id] == true">
......
249 257
                       addClass=" " [breadcrumbs]="breadcrumbs"></breadcrumbs>
250 258
          <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
251 259
                  [texts]="pageContents['top']"></helper>
252
          <div [class]="(showRefine && !isDashboardView)? 'uk-width-4-5@m  uk-width-4-5@l  uk-width-1-1@s' :'uk-width-1-1'">
260
          <div [class]="(showRefine && !this.properties.isDashboard)?
261
          'uk-width-4-5@m  uk-width-4-5@l  uk-width-1-1@s'
262
          :'uk-width-1-1'">
253 263
            <div *ngIf="showRefine" class="uk-offcanvas-content uk-hidden@m  uk-margin-top">
254 264

  
255 265
              <a href="#offcanvas-usage" uk-toggle>
......
615 625
     [class.switcher_active]="filterToggle">
616 626
  <div id="style_switcher_toggle" (click)="filterToggle= !filterToggle">
617 627
    <i class="  uk-text-muted">
618
      <svg style="margin-top: 6px;" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24"
628
      <svg style="margin-top: 8px;" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24"
619 629
           viewBox="0 0 24 24"
620 630
           fill="white" width="24px" height="24px">
621 631
        <g>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
107 107

  
108 108
  //Dashboard
109 109
  filterToggle = false;
110
  customFilterEnabled:boolean =  false;
110 111
  constructor(private route: ActivatedRoute,
111 112
              private location: Location,
112 113
              private _meta: Meta,
......
139 140
      if (params['page'] && params['page']!=1) {
140 141
        HelperFunctions.scrollToId("searchForm");
141 142
      }
143
      this.customFilterEnabled = params['cf'] && params['cf'] == "true";
142 144
    });
143 145
    var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.pageTitle;
144 146

  
......
867 869
        allFqs += fq;
868 870
      }
869 871
    }
870
    if(this.customFilter && this.customFilter.isHiddenFilter){
872
    this.customFilterEnabled = URLparams["cf"] == "true";
873
    if(this.customFilter && (this.customFilter.isHiddenFilter || (this.refineFields.indexOf(this.customFilter.queryFieldName) == -1 && this.customFilterEnabled))){
871 874
      allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
872 875
    }
873 876

  
......
1192 1195
        this.parameterValues.push("" + this.quickFilter.selected);
1193 1196
      }
1194 1197
    }
1195

  
1198
    if(this.customFilterEnabled){
1199
      this.parameterNames.push("cf");
1200
      this.parameterValues.push("true");
1201
    }
1196 1202
    // if (this.searchUtils.size != this.resultsPerPage) {
1197 1203
    //   // allLimits += ((allLimits.length == 0) ? '?' : '&') + 'size=' + this.searchUtils.size;
1198 1204
    //   this.parameterNames.push("size");

Also available in: Unified diff