Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Let headlines be part of menu items

Kabiru Mwenjaf6c4d47fafd9
diff --git a/frontend/src/app/features/work-packages/components/wp-buttons/wp-reminder-button/wp-reminder-context-menu.directive.ts b/frontend/src/app/features/work-packages/components/wp-buttons/wp-reminder-button/wp-reminder-context-menu.directive.ts
index fb3cc74decb..1445cda64f2 100644
--- a/frontend/src/app/features/work-packages/components/wp-buttons/wp-reminder-button/wp-reminder-context-menu.directive.ts
+++ b/frontend/src/app/features/work-packages/components/wp-buttons/wp-reminder-button/wp-reminder-context-menu.directive.ts
@@ -36,12 +36,21 @@ export class WorkPackageReminderContextMenuDirective extends OpContextMenuTrigge
items: this.items,
contextMenuId: 'reminder-dropdown-menu',
label: this.I18n.t('js.work_packages.reminders.title.new'),
- visibleLabel: true,
};
}
private buildItems() {
- this.items = REMINDER_PRESET_OPTIONS.map((preset) => ({
+ this.items = [
+ {
+ isHeader: true,
+ linkText: this.I18n.t('js.work_packages.reminders.title.new'),
+ },
+ ...this.buildPresetItems(),
+ ];
+ }
+
+ private buildPresetItems() {
+ return REMINDER_PRESET_OPTIONS.map((preset) => ({
disabled: false,
linkText: this.I18n.t(`js.work_packages.reminders.presets.${preset}`),
onClick: () => {
diff --git a/frontend/src/app/shared/components/op-context-menu/op-context-menu.html b/frontend/src/app/shared/components/op-context-menu/op-context-menu.html
index 93fb879b3aa..7b05a8072f7 100644
--- a/frontend/src/app/shared/components/op-context-menu/op-context-menu.html
+++ b/frontend/src/app/shared/components/op-context-menu/op-context-menu.html
@@ -5,17 +5,17 @@
role="menu"
[attr.aria-label]="locals.label"
[ngClass]="{'-empty': items.length === 0 }">
- <li *ngIf="locals.visibleLabel && locals.label" role="none">
- <span
- role="presentation"
- [attr.aria-hidden]="true"
- [textContent]="locals.label"
- class="op-menu--headline">
- </span>
- </li>
<ng-container *ngFor="let item of items">
+ <li *ngIf="item.isHeader" role="none">
+ <span
+ role="presentation"
+ [attr.aria-hidden]="true"
+ [textContent]="item.linkText"
+ class="op-menu--headline">
+ </span>
+ </li>
<li *ngIf="item.divider" class="dropdown-divider" role="separator"></li>
- <li *ngIf="!item.divider">
+ <li *ngIf="!item.divider && !item.isHeader">
<a
*ngIf="item.href"
class="menu-item"
diff --git a/frontend/src/app/shared/components/op-context-menu/op-context-menu.types.ts b/frontend/src/app/shared/components/op-context-menu/op-context-menu.types.ts
index 7c0a6176379..31b2027e01a 100644
--- a/frontend/src/app/shared/components/op-context-menu/op-context-menu.types.ts
+++ b/frontend/src/app/shared/components/op-context-menu/op-context-menu.types.ts
@@ -12,6 +12,7 @@ export interface OpContextMenuItem {
linkText?:string;
title?:string;
divider?:boolean;
+ isHeader?:boolean;
onClick?:($event:JQuery.TriggeredEvent|MouseEvent) => boolean;
}
@@ -20,7 +21,6 @@ export interface OpContextMenuLocalsMap {
showAnchorRight?:boolean;
contextMenuId?:string;
label?:string;
- visibleLabel?:boolean;
/* eslint-disable @typescript-eslint/no-explicit-any */
[key:string]:any;
}