Skip to content

Commit e06025f

Browse files
FrancescoMolinaroatarix83
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-1864-fix-context-menu (pull request DSpace#2438)
[DSC-1864] fix template function Approved-by: Giuseppe Digilio
2 parents fbb04ca + 5eab36b commit e06025f

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/app/shared/context-menu/context-menu.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div *ngIf="contextMenuObject">
22
<div class="d-flex space-children-mr justify-content-end" *dsRenderOnlyForBrowser="true">
3-
<ng-container *ngFor="let entry of (getStandAloneMenuEntries() | async)">
3+
<ng-container *ngFor="let entry of (standAloneEntries$ | async)">
44
<ng-container *ngComponentOutlet="entry; injector: objectInjector;"></ng-container>
55
</ng-container>
66
<div ngbDropdown #itemOptions="ngbDropdown" placement="bottom-right"
@@ -10,7 +10,7 @@
1010
</button>
1111
<div id="itemOptionsDropdownMenu" aria-labelledby="context-menu" ngbDropdownMenu>
1212
<h6 class="dropdown-header">{{ 'context-menu.actions.label' | translate }}</h6>
13-
<ng-container *ngFor="let entry of (getContextMenuEntries() | async)">
13+
<ng-container *ngFor="let entry of (contextEntries$ | async)">
1414
<ng-container *ngComponentOutlet="entry; injector: objectInjector;"></ng-container>
1515
</ng-container>
1616
</div>

src/app/shared/context-menu/context-menu.component.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChangeDetectorRef, Component, Inject, Injector, Input, OnInit } from '@angular/core';
1+
import { AfterViewChecked, ChangeDetectorRef, Component, Inject, Injector, Input, OnInit } from '@angular/core';
22
import { DOCUMENT } from '@angular/common';
33

44
import { from, Observable } from 'rxjs';
@@ -24,7 +24,7 @@ import { GenericConstructor } from '../../core/shared/generic-constructor';
2424
styleUrls: ['./context-menu.component.scss'],
2525
templateUrl: './context-menu.component.html'
2626
})
27-
export class ContextMenuComponent implements OnInit {
27+
export class ContextMenuComponent implements OnInit, AfterViewChecked {
2828

2929
/**
3030
* The related item
@@ -48,6 +48,9 @@ export class ContextMenuComponent implements OnInit {
4848
*/
4949
public optionCount = 0;
5050

51+
public standAloneEntries$: Observable<any>;
52+
public contextEntries$: Observable<any>;
53+
5154
/**
5255
* Initialize instance variables
5356
*
@@ -71,6 +74,9 @@ export class ContextMenuComponent implements OnInit {
7174
],
7275
parent: this.injector
7376
});
77+
78+
this.standAloneEntries$ = this.getStandAloneMenuEntries();
79+
this.contextEntries$ = this.getContextMenuEntries();
7480
}
7581

7682
/**
@@ -118,10 +124,6 @@ export class ContextMenuComponent implements OnInit {
118124
);
119125
}
120126

121-
isItem(): boolean {
122-
return this.contextMenuObjectType === DSpaceObjectType.ITEM;
123-
}
124-
125127
ngAfterViewChecked() {
126128
// To check that Context-menu contains options or not
127129
if (this._document.getElementById('itemOptionsDropdownMenu')) {

0 commit comments

Comments
 (0)