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 (
private route: ActivatedRoute,
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 config: ConfigurationService,
private _communityService:CommunityService,
@ -69,8 +71,8 @@ export class CommunityComponent {
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.url
this.properties = data.envSpecific;
var url = data.envSpecific.baseLink+this._router.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 {Observable} from 'rxjs/Observable';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import {Title, Meta} from '@angular/platform-browser';
import {Observable} from 'rxjs/Observable';
import "rxjs/add/observable/zip";
import {Meta} from '../openaireLibrary/sharedComponents/metaService';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
import { EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import { ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
@Component({
selector: 'communities',
templateUrl: 'communities.component.html',
@ -20,42 +21,40 @@ export class CommunitiesComponent {
public subfunders: any;
public pageTitle = "OpenAIRE"
properties:EnvProperties;
properties:EnvProperties;
constructor (
private route: ActivatedRoute,
private _router: Router,
private location: Location, private _meta: Meta,private _piwikService:PiwikService,
private config: ConfigurationService
) {
private _router: Router,
private location: Location,
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() {
if(this.piwiksub){
this.piwiksub.unsubscribe();

View File

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

View File

@ -1,7 +1,11 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Component, Input} from '@angular/core';
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";
@ -14,11 +18,9 @@ import {CommunityService} from "../openaireLibrary/connect/community/
import {CommunitiesService} from "../openaireLibrary/connect/communities/communities.service";
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.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 {
availableCharts, availableEntitiesMap, StatisticsDisplay,
import {availableCharts, availableEntitiesMap, StatisticsDisplay,
StatisticsSummary
} from "../openaireLibrary/connect/statistics/statisticsEntities";
@ -61,6 +63,7 @@ export class StatisticsComponent {
private _router: Router,
private location: Location,
private _meta: Meta,
private _title: Title,
private _piwikService:PiwikService,
private config: ConfigurationService,
private _communityService:CommunityService,
@ -68,19 +71,15 @@ export class StatisticsComponent {
private _statisticsService: StatisticsService,
private _configService: ConfigurationService,
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 title = "OpenAIRE";
this._meta.setTitle(title);
this._meta.updateMeta("description", description);
this._meta.updateProperty("og:description", description);
this._meta.updateProperty("og:title", title);
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'");
}
public ngOnInit() {
@ -88,7 +87,7 @@ export class StatisticsComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
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')){
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE").subscribe();
}

View File

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