Revision 59820
Added by Argiro Kokogiannaki over 3 years ago
searchFilter.component.ts | ||
---|---|---|
249 | 249 |
params['qf']="false"; |
250 | 250 |
qf=true; |
251 | 251 |
} |
252 |
if(params[filter.filterId] && params[filter.filterId].indexOf(encodeURIComponent(value.id))==-1 && !qf) {
|
|
252 |
if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1 && !qf) {
|
|
253 | 253 |
//has other values of this filter --> add this value |
254 | 254 |
params[filter.filterId] = params[filter.filterId] + ',' + '"' + encodeURIComponent(value.id) + '"'; |
255 |
}else if(params[filter.filterId] && params[filter.filterId].indexOf(encodeURIComponent(value.id))!=-1) {
|
|
255 |
}else if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)!=-1) {
|
|
256 | 256 |
// has this filter and the value -- > remove it |
257 | 257 |
|
258 | 258 |
let values = params[filter.filterId].split(','); |
259 |
values.splice(values.indexOf('"' + encodeURIComponent(value.id)+'"'), 1);
|
|
259 |
values.splice(this.checkIfValueIndexOf(values,value.id), 1);
|
|
260 | 260 |
params[filter.filterId] =values.join(','); |
261 | 261 |
if(values.length == 0){ |
262 | 262 |
delete params[filter.filterId]; |
... | ... | |
268 | 268 |
delete params['page']; |
269 | 269 |
return params; |
270 | 270 |
} |
271 |
checkIfValueIndexOf(array, value){ |
|
272 |
let encodedValue = encodeURIComponent(value); |
|
273 |
if(array.indexOf(encodedValue)!=-1){ |
|
274 |
return array.indexOf(encodedValue); |
|
275 |
} |
|
276 |
if(array.indexOf('"'+encodedValue+'"')!=-1){ |
|
277 |
return array.indexOf('"'+encodedValue+'"'); |
|
278 |
} |
|
279 |
return -1; |
|
280 |
} |
|
271 | 281 |
} |
Also available in: Unified diff
[Library|Trunk]
Search Filters fix:
- make them work for static filters (e.g datasource pages)
- make it work when new filter is substring of selected filter (e.g 'Registry' & 'Registry of repositories')
- make it work with and without quotes
SEO:
- datasource landing add description in meta tags
- result landing make h2 the title in other versions (only one H1 per page)