Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,32 @@ <h2 class="flex align-items-center gap-2">
{{ duplicate.title }}
</h2>

<div>
@if (showMoreOptions(duplicate)) {
@if (showMoreOptions(duplicate)) {
<div>
<p-button
severity="contrast"
icon="fas fa-ellipsis-vertical"
raised
variant="outlined"
[ariaLabel]="'common.buttons.more' | translate"
(onClick)="componentActionMenu.toggle($event)"
(onClick)="menu.toggle($event)"
>
</p-button>
}

<p-menu appendTo="body" #componentActionMenu [model]="forkActionItems(duplicate.id)" popup>
<ng-template #item let-item>
<a class="p-menu-item-link">{{ item.label | translate }}</a>
</ng-template>
</p-menu>
</div>
<p-menu appendTo="body" [model]="forkActionItems(duplicate.id)" popup #menu>
<ng-template #item let-item>
<a
class="p-menu-item-link"
(mousedown)="handleMenuAction(item.action, item.resourceId)"
(keydown.enter)="handleMenuAction(item.action, item.resourceId)"
tabindex="0"
>
{{ item.label | translate }}
</a>
</ng-template>
</p-menu>
</div>
}
</div>

<div class="flex flex-column gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,18 @@ export class ViewDuplicatesComponent {
readonly forkActionItems = (resourceId: string) => [
{
label: 'project.overview.actions.manageContributors',
command: () => this.router.navigate([resourceId, 'contributors']),
action: 'manageContributors',
resourceId,
},
{
label: 'project.overview.actions.settings',
command: () => this.router.navigate([resourceId, 'settings']),
action: 'settings',
resourceId,
},
{
label: 'project.overview.actions.delete',
command: () => this.handleDeleteFork(resourceId),
action: 'delete',
resourceId,
},
];

Expand Down Expand Up @@ -175,6 +178,20 @@ export class ViewDuplicatesComponent {
);
}

handleMenuAction(action: string, resourceId: string): void {
switch (action) {
case 'manageContributors':
this.router.navigate([resourceId, 'contributors']);
break;
case 'settings':
this.router.navigate([resourceId, 'settings']);
break;
case 'delete':
this.handleDeleteFork(resourceId);
break;
}
}

handleForkResource(): void {
const toolbarResource = this.toolbarResource();
const dialogWidth = !this.isSmall() ? '95vw' : '450px';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,32 @@ <h2 class="flex align-items-center gap-2">
<a class="component-title" [href]="component.id">{{ component.title }}</a>
</h2>

<div>
@if (isCurrentUserContributor(component)) {
@if (!isCurrentUserContributor(component)) {
<div>
<p-button
severity="contrast"
icon="fas fa-ellipsis-vertical"
raised
variant="outlined"
[ariaLabel]="'common.buttons.more' | translate"
(onClick)="componentActionMenu.toggle($event)"
(onClick)="menu.toggle($event)"
>
</p-button>
}

<p-menu appendTo="body" #componentActionMenu [model]="componentActionItems(component)" popup>
<ng-template #item let-item>
<a
class="p-menu-item-link"
(click)="handleMenuAction(item.action, item.componentId)"
(keydown.enter)="handleMenuAction(item.action, item.componentId)"
tabindex="0"
>
{{ item.label | translate }}
</a>
</ng-template>
</p-menu>
</div>
<p-menu appendTo="body" [model]="componentActionItems(component)" popup #menu>
<ng-template #item let-item>
<a
class="p-menu-item-link"
(mousedown)="handleMenuAction(item.action, item.componentId)"
(keydown.enter)="handleMenuAction(item.action, item.componentId)"
tabindex="0"
>
{{ item.label | translate }}
</a>
</ng-template>
</p-menu>
</div>
}
</div>

<div class="flex flex-wrap gap-1">
Expand Down
Loading