[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) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59820 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
1d5c753ff6
commit
8569010477
|
@ -238,8 +238,8 @@ export class DataProviderComponent {
|
|||
this.initTabs();
|
||||
}
|
||||
this.showTabs = true;
|
||||
this.updateTitle(this.dataProviderInfo.title.name);
|
||||
this.updateDescription("Content provider, " + this.dataProviderInfo.title.name);
|
||||
this.updateTitle(this.dataProviderInfo.title.name?this.dataProviderInfo.title.name:this.dataProviderInfo.officialName);
|
||||
this.updateDescription(this.dataProviderInfo.description?this.dataProviderInfo.description: "Content provider, " + (this.dataProviderInfo.title.name?this.dataProviderInfo.title.name:this.dataProviderInfo.officialName));
|
||||
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.dataProviderInfo.title.name, this.piwikSiteId).subscribe());
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ import {AlertModal} from "../../../utils/modal/alert";
|
|||
class="under-curation">Under curation</span>
|
||||
</span>
|
||||
</div>
|
||||
<showTitle [titleName]="title" classNames="uk-margin-remove-bottom"></showTitle>
|
||||
<showTitle [titleName]="title" classNames="uk-margin-remove-bottom" [isH1]="isTitleH1"></showTitle>
|
||||
<div *ngIf="subTitle">
|
||||
<span class="uk-text-muted" [innerHTML]="subTitle"></span>
|
||||
</div>
|
||||
|
@ -75,7 +75,7 @@ export class LandingHeaderComponent {
|
|||
@Input() underCuration: boolean = false;
|
||||
@Input() modal: AlertModal;
|
||||
@Input() titleClass: string = null;
|
||||
|
||||
@Input() isTitleH1:boolean =true;
|
||||
public removeUnknown(array: string[], type: boolean = false): string[] {
|
||||
if (type) {
|
||||
return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown');
|
||||
|
|
|
@ -4,7 +4,13 @@ import {ActivatedRoute} from '@angular/router';
|
|||
@Component({
|
||||
selector: 'showTitle',
|
||||
template: `
|
||||
<h1 [ngClass]="classNames">
|
||||
<h1 *ngIf="isH1" [ngClass]="classNames">
|
||||
<ng-container *ngTemplateOutlet="_title;"></ng-container>
|
||||
</h1>
|
||||
<h2 *ngIf="!isH1" [ngClass]="classNames">
|
||||
<ng-container *ngTemplateOutlet="_title;"></ng-container>
|
||||
</h2>
|
||||
<ng-template #_title>
|
||||
<div *ngIf="title != undefined" class="landingTitle">
|
||||
<span *ngIf="title['url'] != undefined && title['url'] != null && title['url'] != ''"
|
||||
class="custom-external">
|
||||
|
@ -33,7 +39,7 @@ import {ActivatedRoute} from '@angular/router';
|
|||
<div *ngIf="!titleName && !title">
|
||||
<span>No title available</span>
|
||||
</div>
|
||||
</h1>
|
||||
</ng-template>
|
||||
`
|
||||
|
||||
})
|
||||
|
@ -43,6 +49,7 @@ export class ShowTitleComponent {
|
|||
@Input() title: { [key: string]: string };
|
||||
@Input() iconClass:string;
|
||||
@Input() classNames: string = "";
|
||||
@Input() isH1:boolean = true;
|
||||
|
||||
constructor () {}
|
||||
|
||||
|
|
|
@ -506,7 +506,8 @@
|
|||
[subTitle]="resultLandingInfo.subtitle" [authorLimit]="10" [showAllAuthors]="false"
|
||||
titleClass="title-grey-background"
|
||||
[entityType]="getTypeName()" [authors]="resultLandingInfo.authors" [types]="resultLandingInfo.types"
|
||||
[year]="resultLandingInfo.date" [embargoEndDate]="resultLandingInfo.embargoEndDate">
|
||||
[year]="resultLandingInfo.date" [embargoEndDate]="resultLandingInfo.embargoEndDate"
|
||||
[isTitleH1]="false">
|
||||
</landing-header>
|
||||
<div class="uk-margin-medium-top uk-margin-medium-right">
|
||||
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
|
||||
|
|
|
@ -112,7 +112,6 @@ export class SearchDataProvidersComponent {
|
|||
this.isPiwikEnabled = properties.enablePiwikTrack;
|
||||
|
||||
let firstLoad = true;
|
||||
this.filters = DatasourcesHelperClass.createFilters(this.type);
|
||||
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||
this.loadPaging = true;
|
||||
if(params['page'] && this.searchUtils.page != params['page']) {
|
||||
|
@ -148,6 +147,7 @@ export class SearchDataProvidersComponent {
|
|||
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
|
||||
} else if(refine) { // static filters
|
||||
this.searchUtils.refineStatus = this.errorCodes.LOADING;
|
||||
this.filters = DatasourcesHelperClass.createFilters(this.type);
|
||||
} else {
|
||||
this.searchUtils.refineStatus = this.errorCodes.DONE;
|
||||
}
|
||||
|
@ -256,6 +256,9 @@ export class SearchDataProvidersComponent {
|
|||
data => {
|
||||
let totalResults = data[0];
|
||||
let results = data[1];
|
||||
if(refine && !(this.type == "all" || this.type == "deposit")){
|
||||
this.filtersReturned(refine, this.filters, totalResults, page);
|
||||
}
|
||||
this.resultsReturned(refine, results, totalResults, page);
|
||||
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
|
||||
},
|
||||
|
|
|
@ -249,14 +249,14 @@ export class SearchFilterComponent implements OnInit, OnChanges{
|
|||
params['qf']="false";
|
||||
qf=true;
|
||||
}
|
||||
if(params[filter.filterId] && params[filter.filterId].indexOf(encodeURIComponent(value.id))==-1 && !qf) {
|
||||
if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)==-1 && !qf) {
|
||||
//has other values of this filter --> add this value
|
||||
params[filter.filterId] = params[filter.filterId] + ',' + '"' + encodeURIComponent(value.id) + '"';
|
||||
}else if(params[filter.filterId] && params[filter.filterId].indexOf(encodeURIComponent(value.id))!=-1) {
|
||||
}else if(params[filter.filterId] && this.checkIfValueIndexOf(params[filter.filterId].split(','),value.id)!=-1) {
|
||||
// has this filter and the value -- > remove it
|
||||
|
||||
let values = params[filter.filterId].split(',');
|
||||
values.splice(values.indexOf('"' + encodeURIComponent(value.id)+'"'), 1);
|
||||
values.splice(this.checkIfValueIndexOf(values,value.id), 1);
|
||||
params[filter.filterId] =values.join(',');
|
||||
if(values.length == 0){
|
||||
delete params[filter.filterId];
|
||||
|
@ -268,4 +268,14 @@ export class SearchFilterComponent implements OnInit, OnChanges{
|
|||
delete params['page'];
|
||||
return params;
|
||||
}
|
||||
checkIfValueIndexOf(array, value){
|
||||
let encodedValue = encodeURIComponent(value);
|
||||
if(array.indexOf(encodedValue)!=-1){
|
||||
return array.indexOf(encodedValue);
|
||||
}
|
||||
if(array.indexOf('"'+encodedValue+'"')!=-1){
|
||||
return array.indexOf('"'+encodedValue+'"');
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue