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

Add UIsref option for op-sidemenu component and use it in the notification center.

Benjamin Bädorfaa17e7c010a4
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
index d3f09331a31..a6ba795503a 100644
--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
@@ -27,7 +27,8 @@ export class IanMenuComponent implements OnInit {
key: 'inbox',
title: this.I18n.t('js.notifications.menu.inbox'),
icon: 'inbox',
- href: this.getHrefForFilters({}),
+ uiSref: 'notifications.center.show',
+ uiParams: { filter: '', name: '' },
},
];
@@ -36,25 +37,25 @@ export class IanMenuComponent implements OnInit {
key: 'mentioned',
title: this.I18n.t('js.notifications.menu.mentioned'),
icon: 'mention',
- href: this.getHrefForFilters({ filter: 'reason', name: 'mentioned' }),
+ ...this.getUiLinkForFilters({ filter: 'reason', name: 'mentioned' }),
},
{
key: 'assigned',
title: this.I18n.t('js.notifications.menu.assigned'),
icon: 'assigned',
- href: this.getHrefForFilters({ filter: 'reason', name: 'assigned' }),
+ ...this.getUiLinkForFilters({ filter: 'reason', name: 'assigned' }),
},
{
key: 'responsible',
title: this.I18n.t('js.notifications.menu.accountable'),
icon: 'accountable',
- href: this.getHrefForFilters({ filter: 'reason', name: 'responsible' }),
+ ...this.getUiLinkForFilters({ filter: 'reason', name: 'responsible' }),
},
{
key: 'watched',
title: this.I18n.t('js.notifications.menu.watching'),
icon: 'watching',
- href: this.getHrefForFilters({ filter: 'reason', name: 'watched' }),
+ ...this.getUiLinkForFilters({ filter: 'reason', name: 'watched' }),
},
];
@@ -63,7 +64,7 @@ export class IanMenuComponent implements OnInit {
.map((item) => ({
...item,
title: (item.projectHasParent ? '... ' : '') + item.value,
- href: this.getHrefForFilters({ filter: 'project', name: idFromLink(item._links.valueLink[0].href) }),
+ ...this.getUiLinkForFilters({ filter: 'project', name: idFromLink(item._links.valueLink[0].href) }),
}))
.sort((a, b) => {
if (b.projectHasParent && !a.projectHasParent) {
@@ -123,7 +124,10 @@ export class IanMenuComponent implements OnInit {
this.ianMenuService.reload();
}
- private getHrefForFilters(filters:INotificationPageQueryParameters = {}) {
- return this.state.href('notifications', filters);
+ private getUiLinkForFilters(filters:INotificationPageQueryParameters = {}) {
+ return {
+ uiSref: 'notifications.center.show',
+ uiParams: filters,
+ };
}
}
diff --git a/frontend/src/app/shared/components/sidemenu/sidemenu.component.html b/frontend/src/app/shared/components/sidemenu/sidemenu.component.html
index 0c3abb7c7d5..59b8d5b382b 100644
--- a/frontend/src/app/shared/components/sidemenu/sidemenu.component.html
+++ b/frontend/src/app/shared/components/sidemenu/sidemenu.component.html
@@ -29,8 +29,12 @@
>
<a
class="op-sidemenu--item-action"
+ uiSrefActive="op-sidemenu--item-action_active-child"
+ uiSrefActiveEq="op-sidemenu--item-action_active"
[attr.data-qa-selector]="'op-sidemenu--item-action--' + item.title.split(' ').join('')"
[href]="item.href"
+ [uiSref]="item.uiSref"
+ [uiParams]="item.uiParams"
*ngIf="!item.children"
>
<span
diff --git a/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass b/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass
index 4f640b7105d..0a3b532fa83 100644
--- a/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass
+++ b/frontend/src/app/shared/components/sidemenu/sidemenu.component.sass
@@ -34,6 +34,14 @@
background: var(--main-menu-bg-hover-background)
color: var(--main-menu-hover-font-color)
+ &_active
+ background: var(--main-menu-bg-selected-background)
+ color: var(--main-menu-selected-font-color)
+
+ &_active-child
+ background: var(--main-menu-bg-selected-background)
+ color: var(--main-menu-selected-font-color)
+
&--item-title
margin-right: auto
overflow: hidden
diff --git a/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts b/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts
index cbb19c9cc0b..7fe38995dca 100644
--- a/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts
+++ b/frontend/src/app/shared/components/sidemenu/sidemenu.component.ts
@@ -11,7 +11,9 @@ export interface IOpSidemenuItem {
title:string;
icon?:string;
count?:number;
- href:string;
+ href?:string;
+ uiSref?:string;
+ uiParams?:any;
children?:IOpSidemenuItem[];
collapsible?:boolean;
}