Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/DSC-1864-fix-context-menu (pull …
Browse files Browse the repository at this point in the history
…request DSpace#2438)

[DSC-1864] fix template function

Approved-by: Giuseppe Digilio
  • Loading branch information
FrancescoMolinaro authored and atarix83 committed Oct 25, 2024
2 parents fbb04ca + 5eab36b commit e06025f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/app/shared/context-menu/context-menu.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div *ngIf="contextMenuObject">
<div class="d-flex space-children-mr justify-content-end" *dsRenderOnlyForBrowser="true">
<ng-container *ngFor="let entry of (getStandAloneMenuEntries() | async)">
<ng-container *ngFor="let entry of (standAloneEntries$ | async)">
<ng-container *ngComponentOutlet="entry; injector: objectInjector;"></ng-container>
</ng-container>
<div ngbDropdown #itemOptions="ngbDropdown" placement="bottom-right"
Expand All @@ -10,7 +10,7 @@
</button>
<div id="itemOptionsDropdownMenu" aria-labelledby="context-menu" ngbDropdownMenu>
<h6 class="dropdown-header">{{ 'context-menu.actions.label' | translate }}</h6>
<ng-container *ngFor="let entry of (getContextMenuEntries() | async)">
<ng-container *ngFor="let entry of (contextEntries$ | async)">
<ng-container *ngComponentOutlet="entry; injector: objectInjector;"></ng-container>
</ng-container>
</div>
Expand Down
14 changes: 8 additions & 6 deletions src/app/shared/context-menu/context-menu.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectorRef, Component, Inject, Injector, Input, OnInit } from '@angular/core';
import { AfterViewChecked, ChangeDetectorRef, Component, Inject, Injector, Input, OnInit } from '@angular/core';
import { DOCUMENT } from '@angular/common';

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

/**
* The related item
Expand All @@ -48,6 +48,9 @@ export class ContextMenuComponent implements OnInit {
*/
public optionCount = 0;

public standAloneEntries$: Observable<any>;
public contextEntries$: Observable<any>;

/**
* Initialize instance variables
*
Expand All @@ -71,6 +74,9 @@ export class ContextMenuComponent implements OnInit {
],
parent: this.injector
});

this.standAloneEntries$ = this.getStandAloneMenuEntries();
this.contextEntries$ = this.getContextMenuEntries();
}

/**
Expand Down Expand Up @@ -118,10 +124,6 @@ export class ContextMenuComponent implements OnInit {
);
}

isItem(): boolean {
return this.contextMenuObjectType === DSpaceObjectType.ITEM;
}

ngAfterViewChecked() {
// To check that Context-menu contains options or not
if (this._document.getElementById('itemOptionsDropdownMenu')) {
Expand Down

0 comments on commit e06025f

Please sign in to comment.