[Trunk|Library]: Add help texts top and bottom on advanced search.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56649 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-22 11:05:39 +00:00
parent 11cf47ac5a
commit 46ca524ce5
4 changed files with 221 additions and 207 deletions

View File

@ -30,14 +30,10 @@
<div uk-grid uk-grid> <div uk-grid uk-grid>
<div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first "> <div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first ">
<div class="uk-container"> <div class="uk-container">
<div> <div>
<div class="uk-width-1-1"> <helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" [texts]="pageContents['top']"></helper>
<helper position="top"></helper>
</div>
<div class="uk-width-1-1 uk-grid helper-grid uk-padding-large uk-padding-remove-top" > <div class="uk-width-1-1 uk-grid helper-grid uk-padding-large uk-padding-remove-top" >
<helper class="uk-margin-top helper-left-right uk-visible@m" position="left"></helper>
<div class="uk-width-expand@m uk-with-1-1@s"> <div class="uk-width-expand@m uk-with-1-1@s">
<div *ngIf="openaireLink"> <a class="uk-margin-top uk-button uk-button-text" [href]=openaireLink target="_blank" >Results in OpenAIRE</a></div> <div *ngIf="openaireLink"> <a class="uk-margin-top uk-button uk-button-text" [href]=openaireLink target="_blank" >Results in OpenAIRE</a></div>
<div class="uk-align-center uk-margin-remove-bottom"> <div class="uk-align-center uk-margin-remove-bottom">
@ -76,24 +72,16 @@
[href]="properties.lastIndexInformationLink" target="_blank"> [href]="properties.lastIndexInformationLink" target="_blank">
Last index information Last index information
</a> </a>
<helper class="uk-hidden@m" position="left" styleName="uk-width-1-1@s"></helper>
<helper class="uk-hidden@m" position="right" styleName="uk-width-1-1@s"></helper>
</div> </div>
<div class="uk-visible@m uk-margin-top helper-left-right"> <div class="uk-visible@m uk-margin-top uk-width-1-5">
<helper position="right" before="true"></helper>
<search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download> <search-download [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults" ></search-download>
<helper position="right" before="false"></helper>
</div> </div>
<!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> --> <!-- <helper *ngIf="searchUtils.totalResults > csvLimit" class="uk-margin-top helper-left-right uk-visible@m" position="right"></helper> -->
</div> </div>
<div class="uk-width-1-1"> <helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" [texts]="pageContents['bottom']"></helper>
<helper position="bottom"></helper>
</div> </div>
</div> </div>
</div> </div>
<!--modal-loading [message]= "'Loading results...'"></modal-loading-->
</div>
</div> </div>
</div> </div>

View File

@ -1,23 +1,19 @@
import {Component, Input, ViewChild} from '@angular/core'; import {Component, EventEmitter, Input, Output, ViewChild} from '@angular/core';
import {Output, EventEmitter} from '@angular/core';
import {Location} from '@angular/common'; import {Location} from '@angular/common';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Title, Meta} from '@angular/platform-browser'; import {Meta, Title} from '@angular/platform-browser';
import {Observable} from 'rxjs'; import {AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {Filter, Value, AdvancedField} from '../searchUtils/searchHelperClasses.class';
import {SearchResult} from '../../utils/entities/searchResult';
import {SearchFields, FieldDetails} from '../../utils/properties/searchFields';
import {SearchCustomFilter, SearchUtilsClass} from './searchUtils.class'; import {SearchCustomFilter, SearchUtilsClass} from './searchUtils.class';
import {ModalLoading} from '../../utils/modal/loading.component'; import {ModalLoading} from '../../utils/modal/loading.component';
import {StringUtils, Dates} from '../../utils/string-utils.class'; import {Dates, StringUtils} from '../../utils/string-utils.class';
import {ErrorCodes} from '../../utils/properties/errorCodes'; import {ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class'; import {RouterHelper} from '../../utils/routerHelper.class';
import {PiwikService} from '../../utils/piwik/piwik.service'; import {PiwikService} from '../../utils/piwik/piwik.service';
import {EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {SEOService} from '../../sharedComponents/SEO/SEO.service'; import {SEOService} from '../../sharedComponents/SEO/SEO.service';
import {HelperService} from "../../utils/helper/helper.service";
@Component({ @Component({
selector: 'advanced-search-page', selector: 'advanced-search-page',
@ -56,24 +52,30 @@ export class AdvancedSearchPageComponent {
public resultsPerPage: number = 0; public resultsPerPage: number = 0;
isPiwikEnabled = false; isPiwikEnabled = false;
properties: EnvProperties; properties: EnvProperties;
public pageContents = null;
public divContents = null;
public routerHelper: RouterHelper = new RouterHelper(); public routerHelper: RouterHelper = new RouterHelper();
public errorCodes: ErrorCodes = new ErrorCodes(); public errorCodes: ErrorCodes = new ErrorCodes();
url = null; url = null;
@Output() queryChange = new EventEmitter(); @Output() queryChange = new EventEmitter();
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private location: Location, private location: Location,
private _meta: Meta, private _meta: Meta,
private _title: Title, private _title: Title,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private router: Router, private router: Router,
private seoService: SEOService) { private seoService: SEOService,
private helper: HelperService) {
} }
ngOnInit() { ngOnInit() {
this.route.data this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
//this.getDivContents();
this.getPageContents();
this.pagingLimit = data.envSpecific.pagingLimit; this.pagingLimit = data.envSpecific.pagingLimit;
this.resultsPerPage = data.envSpecific.resultsPerPage; this.resultsPerPage = data.envSpecific.resultsPerPage;
this.csvLimit = data.envSpecific.csvLimit; this.csvLimit = data.envSpecific.csvLimit;
@ -101,21 +103,37 @@ export class AdvancedSearchPageComponent {
} }
private getPageContents() {
this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.pageContents = contents;
})
}
private getDivContents() {
this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.divContents = contents;
})
}
ngOnDestroy() { ngOnDestroy() {
if (this.piwiksub) { if (this.piwiksub) {
this.piwiksub.unsubscribe(); this.piwiksub.unsubscribe();
} }
} }
updateDescription(description: string) { updateDescription(description: string) {
this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "name='description'");
this._meta.updateTag({content: description}, "property='og:description'"); this._meta.updateTag({content: description}, "property='og:description'");
} }
updateTitle(title: string) { updateTitle(title: string) {
var _prefix = "OpenAIRE | "; var _prefix = "OpenAIRE | ";
var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
this._title.setTitle(_title); this._title.setTitle(_title);
this._meta.updateTag({content: _title}, "property='og:title'"); this._meta.updateTag({content: _title}, "property='og:title'");
} }
updateUrl(url: string) { updateUrl(url: string) {
this._meta.updateTag({content: url}, "property='og:url'"); this._meta.updateTag({content: url}, "property='og:url'");
} }
@ -160,8 +178,7 @@ export class AdvancedSearchPageComponent {
this.selectedFields.push(dateField); this.selectedFields.push(dateField);
} }
} } else {
else{
this.selectedFields.push(new AdvancedField(fieldId, fieldparam, this.fieldIdsMap[fieldId].name, this.fieldIdsMap[fieldId].type, StringUtils.unquote(values[j]), operators[j])); this.selectedFields.push(new AdvancedField(fieldId, fieldparam, this.fieldIdsMap[fieldId].name, this.fieldIdsMap[fieldId].type, StringUtils.unquote(values[j]), operators[j]));
} }
} }
@ -172,6 +189,7 @@ export class AdvancedSearchPageComponent {
this.selectedFields.push(new AdvancedField(this.fieldIds[0], fieldparam, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, "", "and")); this.selectedFields.push(new AdvancedField(this.fieldIds[0], fieldparam, this.fieldIdsMap[this.fieldIds[0]].name, this.fieldIdsMap[this.fieldIds[0]].type, "", "and"));
} }
} }
private createUrlParameters(includePage: boolean) { private createUrlParameters(includePage: boolean) {
var params = ""; var params = "";
this.parameterNames.splice(0, this.parameterNames.length); this.parameterNames.splice(0, this.parameterNames.length);
@ -226,6 +244,7 @@ export class AdvancedSearchPageComponent {
return '?' + params; return '?' + params;
} }
public createQueryParameters() { public createQueryParameters() {
var params = ""; var params = "";
var countParams = 0; var countParams = 0;
@ -259,6 +278,7 @@ export class AdvancedSearchPageComponent {
return params; return params;
} }
clearFilters() { clearFilters() {
} }
@ -287,14 +307,17 @@ export class AdvancedSearchPageComponent {
this.goTo(1); this.goTo(1);
} }
pageChanged($event) { pageChanged($event) {
this.searchUtils.page = +$event.value; this.searchUtils.page = +$event.value;
this.goTo(this.searchUtils.page); this.goTo(this.searchUtils.page);
} }
sizeChanged($event) { sizeChanged($event) {
this.searchUtils.size = $event.value; this.searchUtils.size = $event.value;
this.goTo(1); this.goTo(1);
} }
sortByChanged($event) { sortByChanged($event) {
this.searchUtils.sortBy = $event.value; this.searchUtils.sortBy = $event.value;
this.goTo(1); this.goTo(1);
@ -306,6 +329,7 @@ export class AdvancedSearchPageComponent {
public updateBaseUrlWithParameters() { public updateBaseUrlWithParameters() {
this.baseURLWithParameters = this.searchUtils.baseUrl + this.createUrlParameters(false); this.baseURLWithParameters = this.searchUtils.baseUrl + this.createUrlParameters(false);
} }
getOperatorParameter(parameter: string): string { getOperatorParameter(parameter: string): string {
for (let id of this.fieldIds) { for (let id of this.fieldIds) {
if (this.fieldIdsMap[id]["param"] == parameter) { if (this.fieldIdsMap[id]["param"] == parameter) {
@ -313,10 +337,12 @@ export class AdvancedSearchPageComponent {
} }
} }
} }
// for loading // for loading
public openLoading() { public openLoading() {
this.loading.open(); this.loading.open();
} }
public closeLoading() { public closeLoading() {
this.loading.close(); this.loading.close();
} }

View File

@ -120,14 +120,14 @@ export class SearchPageComponent {
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this.router.url,false); this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this.router.url,false);
} }
public getPageContents() { private getPageContents() {
this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => { this.helper.getPageHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.pageContents = contents; this.pageContents = contents;
}) })
} }
public getDivContents() { private getDivContents() {
this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => { this.helper.getDivHelpContents(this.router.url, this.properties, (this.customFilter)?this.customFilter.valueId:null).subscribe(contents => {
this.divContents = contents; this.divContents = contents;
}) })