Revision 59117
Added by Argiro Kokogiannaki almost 4 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/services/servicesUtils/refineResults.class.ts | ||
---|---|---|
20 | 20 |
filter.originalFilterId = fields[j]; |
21 | 21 |
filter.filterType = searchFields.getFieldFilterType(fields[j], entityType, usedBy); |
22 | 22 |
filter.filterOperator = searchFields.getFieldOperator(fields[j]); |
23 |
filter.radioValue = ""; |
|
23 | 24 |
//console.info("filter.title: "+filter.title+" filter.filterType: "+filter.filterType); |
24 | 25 |
|
25 | 26 |
let field = data[fields[j]]; |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchHelperClasses.class.ts | ||
---|---|---|
8 | 8 |
public filterOperator: string ='or'; |
9 | 9 |
public valueIsExact: boolean = true; // for search table view, if value is contained or is equal with column entry |
10 | 10 |
public filterType: string = "checkbox"; |
11 |
public radioValue?: string = ""; |
|
11 | 12 |
// public uniqueValueIdSelected: string; |
12 | 13 |
} |
13 | 14 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchFilter.component.html | ||
---|---|---|
43 | 43 |
<input *ngIf="filter.filterType == 'checkbox'" type="checkbox" class="uk-checkbox" |
44 | 44 |
[(ngModel)]="value.selected" (ngModelChange)="filterChange(value.selected)" /> |
45 | 45 |
<input *ngIf="filter.filterType == 'radio'" type="radio" class="uk-radio" |
46 |
[name]="value.id" [value]="true" [(ngModel)]="value.selected" (click)="uniqueFilterChange(value)"/> |
|
46 |
[name]="filter.filterId" [value]="value.id" [(ngModel)]="filter.radioValue" |
|
47 |
(ngModelChange)="uniqueFilterChange(value)"/> |
|
47 | 48 |
{{' '+_formatName(value)}} |
48 | 49 |
<span *ngIf = "showResultCount === true" > |
49 | 50 |
{{' ('+(value.number|number)+')'}} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html | ||
---|---|---|
2 | 2 |
<div class="uk-grid uk-grid-small uk-text-small" uk-grid> |
3 | 3 |
<ng-container *ngIf="customFilterEnabled && customFilter && refineFields.indexOf(customFilter.queryFieldName) == |
4 | 4 |
-1 "> |
5 |
<span> |
|
5 |
<span class="uk-grid-margin">
|
|
6 | 6 |
<span class="selectedFilterLabel uk-disabled "> |
7 | 7 |
<span class="">{{customFilter.valueName}}</span> |
8 | 8 |
</span> |
... | ... | |
11 | 11 |
<ng-container *ngIf="selectedTypesNum > 0 && resultTypes"> |
12 | 12 |
<ng-container *ngFor="let type of resultTypeOptions; let i = index; let end = last; "> |
13 | 13 |
<ng-container *ngIf="resultTypes[type.id] == true"> |
14 |
<span [title]="'Remove '+ type.name" (click)="removeResultType(type.id) "> |
|
14 |
<span class="uk-grid-margin" [title]="'Remove '+ type.name" (click)="removeResultType(type.id) ">
|
|
15 | 15 |
<span class="selectedFilterLabel "> |
16 | 16 |
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '"> |
17 | 17 |
<span class=" clickable" aria-hidden="true"> |
... | ... | |
31 | 31 |
<ng-container *ngIf="selectedRangeFilters > 0"> |
32 | 32 |
<ng-container *ngFor="let filter of rangeFilters "> |
33 | 33 |
<ng-container *ngIf="filter.selectedFromAndToValues"> |
34 |
<span [title]="'Remove '+ filter.selectedFromAndToValues" (click)="removeRangeFilter(filter) "> |
|
34 |
<span [title]="'Remove '+ filter.selectedFromAndToValues" (click)="removeRangeFilter(filter) " class="uk-grid-margin" >
|
|
35 | 35 |
<span class="selectedFilterLabel "> |
36 | 36 |
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '"> |
37 | 37 |
<span class=" clickable" aria-hidden="true"> |
... | ... | |
54 | 54 |
<ng-container *ngFor="let filter of filters "> |
55 | 55 |
<ng-container *ngIf="filter.countSelectedValues > 0"> |
56 | 56 |
<span *ngFor="let value of getSelectedValues(filter); let i = index; let end = last; " |
57 |
[title]="'Remove '+value.name" (click)="removeFilter(value, filter) "> |
|
57 |
[title]="'Remove '+value.name" (click)="removeFilter(value, filter) " class="uk-grid-margin" >
|
|
58 | 58 |
<!-- if no grid on the div above, remove it and move class 'selectedFilterLabel' on top span --> |
59 | 59 |
<span class="selectedFilterLabel "> |
60 | 60 |
<a [class]="((disableForms)?' uk-disabled':' ')+' uk-link-text '"> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchFilter.component.ts | ||
---|---|---|
41 | 41 |
|
42 | 42 |
ngOnInit() { |
43 | 43 |
this.filter.values = this.filter.values.filter(value => !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available')); |
44 |
if(this.filter.filterType == "radio"){ |
|
45 |
this.filter.values.forEach(value => { |
|
46 |
if(value.selected){ |
|
47 |
this.filter.radioValue = value.id |
|
48 |
} |
|
49 |
}); |
|
50 |
} |
|
44 | 51 |
} |
45 | 52 |
|
46 | 53 |
ngOnChanges(changes: SimpleChanges) { |
... | ... | |
96 | 103 |
this.filter.countSelectedValues--; |
97 | 104 |
} |
98 | 105 |
|
106 |
this.filter.values.forEach(value => { |
|
107 |
value.selected = (value.id == this.filter.radioValue); |
|
108 |
}); |
|
99 | 109 |
this.onFilterChange.emit({ |
100 | 110 |
value: this.filter |
101 | 111 |
}); |
... | ... | |
108 | 118 |
this.onFilterChange.emit({ |
109 | 119 |
value: this.filter |
110 | 120 |
}); |
121 |
this.filter.radioValue = ""; |
|
111 | 122 |
} |
112 | 123 |
|
113 | 124 |
getSelectedAndTopValues(filter, topNum: number = 6):any{ |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts | ||
---|---|---|
206 | 206 |
this.filters[i].values[j].selected = false; |
207 | 207 |
} |
208 | 208 |
this.filters[i].countSelectedValues = 0; |
209 |
this.filters[i].radioValue = ""; |
|
209 | 210 |
} |
210 | 211 |
} |
211 | 212 |
this.selectedFilters = 0; |
... | ... | |
217 | 218 |
if (this.quickFilter) { |
218 | 219 |
this.removeValueFromQuickFilter(); |
219 | 220 |
} |
221 |
for(let type of this.resultTypeOptions){ |
|
222 |
this.resultTypes[type.id]=false; |
|
223 |
} |
|
220 | 224 |
this.goTo(1); |
221 | 225 |
// this.clearKeywords(); |
222 | 226 |
} |
... | ... | |
511 | 515 |
if (value.selected == true) { |
512 | 516 |
value.selected = false; |
513 | 517 |
} |
518 |
if(filter.filterType == "radio"){ |
|
519 |
filter.radioValue = ""; |
|
520 |
} |
|
514 | 521 |
if (this.quickFilter && this.quickFilter.filterId == filter.filterId) { |
515 | 522 |
this.removeValueFromQuickFilter(); |
516 | 523 |
} |
Also available in: Unified diff
[Library | Trunk]
Search Filter - radio input:
make it work for radio and make unique selection
add field radioValue
initiate it (in parse refine results) and clear it properly (from new search page)