Project

General

Profile

« Previous | Next » 

Revision 59901

[Library|Trunk]

- Search page - custom filter: add filter value when the custom filter doesn't exists in refine values - this allows to remove it if there are no results

- quick selections: add check for aggregator

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
292 292
                  customFilter.selected == false && customFilter.promptToAddFilter"
293 293
                       class="uk-alert uk-animation-slide-top-small">
294 294
                    Do you want to see results only for {{customFilter.valueName}}? <a
295
                    (click)="addCustomFilter();">Click
296
                    here</a>.
295
                    (click)="addCustomFilter();">Click here</a>.
297 296
                  </div>
298 297
                  <div *ngIf="openaireLink && (searchUtils.totalResults > 0 || !loadPaging )"><a
299 298
                        class="uk-margin-top   uk-button uk-button-text"
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
123 123
  @ViewChild('removeCustomFilter') removeCustomFilter: AlertModal;
124 124
  currentValueToRemove;
125 125
  currentFilterToRemove;
126
  isCustomFilterSelected:boolean = true;
127 126
  constructor(private route: ActivatedRoute,
128 127
              private location: Location,
129 128
              private _meta: Meta,
......
624 623
  }
625 624

  
626 625
  closeCustomFilterModal() {
626
    this.customFilterEnabled = false;
627 627
    this.removeFilter(this.currentValueToRemove, this.currentFilterToRemove, true);
628
    this.isCustomFilterSelected = false;
629 628
  }
630 629

  
631 630
  public removeRangeFilter(filter: RangeFilter) {
......
675 674
   */
676 675
  addCustomFilter() {
677 676
    this.customFilter.selected = true;
678
    if(this.refineFields.indexOf(this.customFilter.queryFieldName) == -1  ){
679
      this.customFilterEnabled = true;
680
    }else {
677
    this.customFilterEnabled = true;
678
    if(this.refineFields.indexOf(this.customFilter.queryFieldName) != -1  ){
679
      let found = false;
681 680
      for (let filter of this.filters) {
682 681
        if (this.customFilter.queryFieldName == filter.filterId) {
683 682
          for (let value of filter.values) {
684 683
            if (value.id == this.customFilter.valueId) {
685 684
              value.selected = true;
686 685
              filter.countSelectedValues++;
686
              found = true;
687
              break;
687 688
            }
688 689
          }
690
          //add filter when field exist in refine but not in the refine values
691
          if(!found){
692
            filter.countSelectedValues ++ ;
693
            filter.values.push({selected : true, name: this.customFilter.valueName, id: this.customFilter.valueId, number:0});
694
          }
695
          break;
689 696
        }
690 697
      }
691 698
    }
......
1015 1022
      }
1016 1023
    }
1017 1024
    this.customFilterEnabled = URLparams["cf"] == "true";
1018
    if(this.customFilter && (this.customFilter.isHiddenFilter || (this.refineFields.indexOf(this.customFilter.queryFieldName) == -1 && this.customFilterEnabled))){
1025
    if(this.customFilter && (this.customFilter.isHiddenFilter || this.customFilterEnabled)){
1019 1026
      allFqs += "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
1020 1027
    }
1021 1028

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/quick-selections.component.ts
92 92
    }));
93 93

  
94 94
    if(this.properties && !this.initialized) {
95
      if(this.properties.adminToolsCommunity !== "monitor") {
95
      if(this.properties.adminToolsCommunity !== "monitor" && this.properties.adminToolsPortalType !== "aggregator" ) {
96 96
         this.subs.push(this.config.communityInformationState.subscribe(data => {
97 97
          if(data) {
98 98
            var showEntity = {};

Also available in: Unified diff