diff --git a/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.html b/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.html index c28321c883e..af99f8a5043 100644 --- a/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.html +++ b/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.html @@ -2,7 +2,7 @@ dsAltmetricData [item]="item" class="altmetric-embed" - data-hide-no-mentions="false" + data-hide-no-mentions="true" data-badge-type="donut" data-badge-popover="right" data-link-target="_blank" diff --git a/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.ts b/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.ts index 2402c21b94d..cde3c3757ab 100644 --- a/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.ts +++ b/src/app/item-page/simple/field-components/specific-field/metrics/altmetric/item-page-altmetric-field.component.ts @@ -1,4 +1,4 @@ -import { AfterViewInit, Component, Inject, Input } from '@angular/core'; +import { AfterViewInit, Component, EventEmitter, HostListener, Inject, Input, Output } from '@angular/core'; import { ExternalScriptLoaderService } from 'src/app/shared/utils/scripts-loader/external-script-loader.service'; import { ExternalScriptsNames, @@ -14,6 +14,8 @@ import { APP_CONFIG, AppConfig } from 'src/config/app-config.interface'; export class ItemPageAltmetricFieldComponent implements AfterViewInit { @Input() item: Item; + @Output() widgetLoaded = new EventEmitter(); + constructor( @Inject(APP_CONFIG) protected appConfig: AppConfig, private scriptLoader: ExternalScriptLoaderService @@ -52,4 +54,9 @@ export class ItemPageAltmetricFieldComponent implements AfterViewInit { element.status === ExternalScriptsStatus.ALREADY_LOADED ); } + + @HostListener('window:altmetric:show', ['$event']) + private onWidgetShow(event: Event) { + this.widgetLoaded.emit(true); + } } diff --git a/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.html b/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.html index f613fff6400..a20751e0e44 100644 --- a/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.html +++ b/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.html @@ -1,11 +1,11 @@
-

+

{{ "item.page.metrics" | translate }}

- +
diff --git a/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.ts b/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.ts index 7537da9144a..95f8a267675 100644 --- a/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.ts +++ b/src/app/item-page/simple/field-components/specific-field/metrics/item-page-metrics-field.component.ts @@ -13,4 +13,12 @@ export class ItemPageMetricsFieldComponent extends ItemPageFieldComponent { @Input() item: Item; + public showTitle = false; + + public someWidgetHasLoaded(widgetLoaded: boolean) { + if (widgetLoaded) { + this.showTitle = true; + } + } + }