Replace Meta service Import and use with Meta and Title from angular/platform-browser for dataset.component and dataset.module

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51761 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-04-11 15:09:23 +00:00
parent 41056150fc
commit 68e52678fe
2 changed files with 49 additions and 41 deletions

View File

@ -1,12 +1,17 @@
import {Component, ViewChild, ElementRef, Input} from '@angular/core'; import {Component, ViewChild} from '@angular/core';
import {Observable} from 'rxjs/Observable'; import {ElementRef, Input} from '@angular/core';
import {DatasetService} from './dataset.service'; import {ActivatedRoute, Router} from '@angular/router';
import {DatasetInfo} from '../../utils/entities/datasetInfo'; import {Title, Meta} from '@angular/platform-browser';
import {ActivatedRoute, Router} from '@angular/router';
import {RouterHelper} from '../../utils/routerHelper.class'; import {Observable} from 'rxjs/Observable';
import { Meta} from '../../sharedComponents/metaService';
import {PiwikService} from '../../utils/piwik/piwik.service'; import {DatasetInfo} from '../../utils/entities/datasetInfo';
import{EnvProperties} from '../../utils/properties/env-properties'; import {EnvProperties} from '../../utils/properties/env-properties';
import {RouterHelper} from '../../utils/routerHelper.class';
import {DatasetService} from './dataset.service';
import {PiwikService} from '../../utils/piwik/piwik.service';
@Component({ @Component({
selector: 'dataset', selector: 'dataset',
@ -14,7 +19,7 @@ import{EnvProperties} from '../../utils/properties/env-properties';
}) })
export class DatasetComponent { export class DatasetComponent {
@Input() piwikSiteId = null; @Input() piwikSiteId = null;
public datasetInfo: DatasetInfo; public datasetInfo: DatasetInfo;
public datasetId : string ; public datasetId : string ;
@ -53,6 +58,7 @@ export class DatasetComponent {
private _piwikService:PiwikService, private _piwikService:PiwikService,
private route: ActivatedRoute, private route: ActivatedRoute,
private _meta: Meta, private _meta: Meta,
private _title: Title,
private _router: Router) { private _router: Router) {
} }
@ -152,17 +158,17 @@ export class DatasetComponent {
} }
private updateDescription(description:string){ private updateDescription(description:string){
this._meta.updateMeta("description", description); this._meta.updateTag({content:description},"name='description'");
this._meta.updateProperty("og:description", description); this._meta.updateTag({content:description},"property='og:description'");
} }
private updateTitle(title:string){ private 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._meta.setTitle(_title ); this._title.setTitle(_title);
this._meta.updateProperty("og:title",_title); this._meta.updateTag({content:_title},"property='og:title'");
} }
private updateUrl(url:string){ private updateUrl(url:string){
this._meta.updateProperty("og:url", url); this._meta.updateTag({content:url},"property='og:url'");
} }
public buildCurationTooltip() { public buildCurationTooltip() {

View File

@ -1,42 +1,44 @@
//import {MaterialModule} from '@angular/material'; // import {MaterialModule} from '@angular/material';
import { NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import { CommonModule } from '@angular/common'; import {CommonModule} from '@angular/common';
import { FormsModule } from '@angular/forms'; import {FormsModule} from '@angular/forms';
import { SharedModule } from '../../shared/shared.module'; import {RouterModule} from '@angular/router';
import { RouterModule } from '@angular/router';
import { DatasetService} from './dataset.service'; import {SharedModule} from '../../shared/shared.module';
import { DatasetComponent } from './dataset.component';
// import { DatasetRoutingModule } from './dataset-routing.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {IFrameModule} from '../../utils/iframe.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import { ResultLandingModule } from '../landing-utils/resultLanding.module'; import {DatasetComponent} from './dataset.component';
import { LandingModule } from '../landing-utils/landing.module';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {MetaModule} from '../../sharedComponents/metaService.module'; import {CiteThisModule} from '../landing-utils/citeThis/citeThis.module';
import { ConfigurationServiceModule } from '../../utils/configuration/configurationService.module'; // import {DatasetRoutingModule} from './dataset-routing.module';
import {LandingModule} from '../landing-utils/landing.module';
import {ResultLandingModule} from '../landing-utils/resultLanding.module';
import {MetricsModule} from '../landing-utils/metrics.module';
import {AltMetricsModule} from '../../utils/altmetrics.module';
import {ConfigurationServiceModule} from '../../utils/configuration/configurationService.module';
import {IFrameModule} from '../../utils/iframe.module';
import {DatasetService} from './dataset.service';
import {FreeGuard} from'../../login/freeGuard.guard';
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
@NgModule({ @NgModule({
imports: [ imports: [
//MaterialModule.forRoot(), //MaterialModule.forRoot(),
CommonModule, FormsModule,SharedModule, RouterModule, LandingModule, CiteThisModule, CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
ResultLandingModule, MetricsModule, IFrameModule, AltMetricsModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule,
MetaModule, ConfigurationServiceModule AltMetricsModule, ConfigurationServiceModule
], ],
declarations: [ declarations: [
DatasetComponent DatasetComponent
], ],
providers:[ providers:[
DatasetService, FreeGuard, IsRouteEnabled DatasetService, FreeGuard, IsRouteEnabled
], ],
exports: [ exports: [
DatasetComponent DatasetComponent
] ]
}) })
export class DatasetModule { } export class DatasetModule { }