Replace meta service import and use with meta and title from angular/platform-browser for communities and statistics

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51838 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-04-17 13:37:38 +00:00
parent 061ba63c7e
commit 70d8375acc
5 changed files with 64 additions and 66 deletions

View File

@ -51,7 +51,9 @@ export class CommunityComponent {
constructor ( constructor (
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
private location: Location, private _meta: Meta, private _title: Title, private location: Location,
private _meta: Meta,
private _title: Title,
private _piwikService:PiwikService, private _piwikService:PiwikService,
private config: ConfigurationService, private config: ConfigurationService,
private _communityService:CommunityService, private _communityService:CommunityService,
@ -69,8 +71,8 @@ export class CommunityComponent {
public ngOnInit() { public ngOnInit() {
this.route.data this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url var url = data.envSpecific.baseLink+this._router.url;
this._meta.updateTag({content:url},"property='og:url'"); this._meta.updateTag({content:url},"property='og:url'");

View File

@ -1,16 +1,17 @@
import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core'; import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common'; import {Location} from '@angular/common';
import {Title, Meta} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import "rxjs/add/observable/zip"; import "rxjs/add/observable/zip";
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
@Component({ @Component({
selector: 'communities', selector: 'communities',
templateUrl: 'communities.component.html', templateUrl: 'communities.component.html',
@ -20,42 +21,40 @@ export class CommunitiesComponent {
public subfunders: any; public subfunders: any;
public pageTitle = "OpenAIRE" public pageTitle = "OpenAIRE"
properties:EnvProperties; properties:EnvProperties;
constructor ( constructor (
private route: ActivatedRoute, private route: ActivatedRoute,
private _router: Router, private _router: Router,
private location: Location, private _meta: Meta,private _piwikService:PiwikService, private location: Location,
private config: ConfigurationService private _meta: Meta,
) { private _title: Title,
private _piwikService:PiwikService,
private config: ConfigurationService) {
var description = "open access, research, research community, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
var title = "OpenAIRE Connect";
var description = "open access, research, research community, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; this._title.setTitle(title);
this._meta.updateTag({content:description},"name='description'");
this._meta.updateTag({content:description},"property='og:description'");
this._meta.updateTag({content:title},"property='og:title'");
var title = "OpenAIRE Connect";
this._meta.setTitle(title);
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
this._meta.updateProperty("og:title", title);
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url
this._meta.updateProperty("og:url", url);
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties,"OpenAIRE").subscribe();
}
});
} }
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url
this._meta.updateTag({content:url},"property='og:url'");
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
this.piwiksub = this._piwikService.trackView(this.properties,"OpenAIRE").subscribe();
}
});
}
public ngOnDestroy() { public ngOnDestroy() {
if(this.piwiksub){ if(this.piwiksub){
this.piwiksub.unsubscribe(); this.piwiksub.unsubscribe();

View File

@ -3,28 +3,27 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import{CommunitiesRoutingModule} from './communities-routing.module'; import {CommunitiesRoutingModule} from './communities-routing.module';
import{CommunitiesComponent} from './communities.component'; import {CommunitiesComponent} from './communities.component';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, CommonModule, FormsModule, RouterModule,
CommunitiesRoutingModule CommunitiesRoutingModule
], ],
declarations: [ declarations: [
CommunitiesComponent CommunitiesComponent
], ],
providers:[ providers: [
FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, PiwikService FreeGuard, PreviousRouteRecorder, ConfigurationService, PiwikService
], ],
exports: [ exports: [
CommunitiesComponent CommunitiesComponent
] ]
}) })
export class CommunitiesModule { } export class CommunitiesModule { }

View File

@ -1,7 +1,11 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import { Location, TitleCasePipe } from '@angular/common'; import {Location, TitleCasePipe} from '@angular/common';
import {Title, Meta} from '@angular/platform-browser';
import {DomSanitizer} from '@angular/platform-browser';
import {SafeResourceUrl, SafeUrl} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import "rxjs/add/observable/zip"; import "rxjs/add/observable/zip";
@ -14,11 +18,9 @@ import {CommunityService} from "../openaireLibrary/connect/community/
import {CommunitiesService} from "../openaireLibrary/connect/communities/communities.service"; import {CommunitiesService} from "../openaireLibrary/connect/communities/communities.service";
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import { DomSanitizer, SafeResourceUrl, SafeUrl } from '@angular/platform-browser';
import {ConnectHelper} from '../openaireLibrary/connect/connectHelper'; import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import { import {availableCharts, availableEntitiesMap, StatisticsDisplay,
availableCharts, availableEntitiesMap, StatisticsDisplay,
StatisticsSummary StatisticsSummary
} from "../openaireLibrary/connect/statistics/statisticsEntities"; } from "../openaireLibrary/connect/statistics/statisticsEntities";
@ -61,6 +63,7 @@ export class StatisticsComponent {
private _router: Router, private _router: Router,
private location: Location, private location: Location,
private _meta: Meta, private _meta: Meta,
private _title: Title,
private _piwikService:PiwikService, private _piwikService:PiwikService,
private config: ConfigurationService, private config: ConfigurationService,
private _communityService:CommunityService, private _communityService:CommunityService,
@ -68,19 +71,15 @@ export class StatisticsComponent {
private _statisticsService: StatisticsService, private _statisticsService: StatisticsService,
private _configService: ConfigurationService, private _configService: ConfigurationService,
private titleCase: TitleCasePipe, private titleCase: TitleCasePipe,
private sanitizer: DomSanitizer private sanitizer: DomSanitizer) {
) {
var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects "; var description = "open access, research, scientific publication, European Commission, EC, FP7, ERC, Horizon 2020, H2020, search, projects ";
var title = "OpenAIRE"; var title = "OpenAIRE";
this._meta.setTitle(title); this._title.setTitle(title);
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'");
this._meta.updateProperty("og:title", title); this._meta.updateTag({content:title},"property='og:title'");
} }
public ngOnInit() { public ngOnInit() {
@ -88,7 +87,7 @@ export class StatisticsComponent {
.subscribe((data: { envSpecific: EnvProperties }) => { .subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific; this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url; var url = data.envSpecific.baseLink+this._router.url;
this._meta.updateProperty("og:url", url); this._meta.updateTag({content:url},"property='og:url'");
if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){ if(this.properties.enablePiwikTrack && (typeof document !== 'undefined')){
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe(); this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
} }

View File

@ -1,5 +1,5 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import { CommonModule, TitleCasePipe } from '@angular/common'; import {CommonModule, TitleCasePipe} from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
@ -12,7 +12,6 @@ import {StatisticsService} from '../utils/services/statistics.service'
import {CommunityService} from '../openaireLibrary/connect/community/community.service'; import {CommunityService} from '../openaireLibrary/connect/community/community.service';
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service'; import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard';
@ -27,8 +26,8 @@ import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previo
StatisticsComponent, StatisticsComponent,
StatisticsForDashboardComponent StatisticsForDashboardComponent
], ],
providers:[ providers: [
FreeGuard, PreviousRouteRecorder, ConfigurationService, Meta, FreeGuard, PreviousRouteRecorder, ConfigurationService,
PiwikService, CommunityService, CommunitiesService, StatisticsService, TitleCasePipe PiwikService, CommunityService, CommunitiesService, StatisticsService, TitleCasePipe
], ],
exports: [ exports: [