From 66ccc04808970172558bf0b0bd315a4de3f81f5c Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Thu, 21 Oct 2021 13:18:28 +0300 Subject: [PATCH] Add twitter tab on community page - development only --- src/app/community/community.component.html | 15 +++++++++++++++ src/app/community/community.component.ts | 18 +++++++++++++++--- src/app/openaireLibrary | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index efd6fd0..e2ce8e4 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -536,6 +536,15 @@ + +
+
+ +
+
+
@@ -572,6 +581,9 @@ [tabTitle]="'Featured datasets'" [tabId]="'enermaps'" [tabNumber]="fetchFeaturedDatasets.searchUtils.totalResults"> + + + @@ -610,6 +622,9 @@ [tabTitle]="'Featured datasets'" [tabId]="'enermaps'" [tabNumber]="fetchFeaturedDatasets.searchUtils.totalResults"> + + + diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index ee6b554..afda8cc 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -1,6 +1,6 @@ -import {Component, ElementRef, Input, ViewChild} from '@angular/core'; +import {Component, ElementRef, Inject, Input, Renderer2, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; -import {Location} from '@angular/common'; +import {DOCUMENT, Location} from '@angular/common'; import {Meta, Title} from '@angular/platform-browser'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; @@ -120,7 +120,9 @@ export class CommunityComponent { private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService, private seoService: SEOService, - private userManagementService: UserManagementService) { + private userManagementService: UserManagementService, + private _renderer2: Renderer2, + @Inject(DOCUMENT) private _document: Document) { var description = "OpenAIRE - Connect, Community Dashboard, research community"; var title = "OpenAIRE - Connect"; @@ -230,6 +232,16 @@ export class CommunityComponent { this.handleError("Error getting community with id: " + this.communityId, error); } )); + + // loading twitter widget script conditionally + if(properties.environment == "development") { + if(this.communityInfo.twitterAccount) { + let script = this._renderer2.createElement('script'); + script.charset = "utf-8"; + script.src = "https://platform.twitter.com/widgets.js"; + this._renderer2.appendChild(this._document.body, script); + } + } } private searchPublications(page: number, size: number) { diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 6405188..0b85dfb 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 64051887ce031b36d74349496912e5c337801c15 +Subproject commit 0b85dfba03e2db942dcbf3b68b453c757f70cbf9