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 tooltips to top menu buttons

Henriette Darge1dedc4f4bf53
diff --git a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
index 6afbc9da8b3..2445ed8682a 100644
--- a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
+++ b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.html
@@ -1,7 +1,7 @@
<ng-container *ngIf="(unreadCount$ | async) as unreadCount">
<span
*ngIf="unreadCount !== 0"
- class="op-ian-bell--indicator"
+ [ngClass]="{ 'op-ian-bell--indicator': true, 'op-ian-bell--indicator_max': unreadCount > bellDisplayLimit }"
data-test-selector="op-ian-notifications-count"
[innerHTML]="unreadCountText$ | async"
></span>
diff --git a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.sass b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.sass
index 676f6bd271f..9c06c009598 100644
--- a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.sass
+++ b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.sass
@@ -6,6 +6,14 @@
&--indicator
@include indicator-bubble
position: absolute
- top: 0
- right: -4px
+ top: 12px
+ right: 0
background: var(--display-red-bgColor-emphasis)
+
+ &_max
+ height: 12px
+ line-height: 12px
+ width: 12px
+ right: 8px
+ top: 15px
+ padding: 0
diff --git a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
index 531869f66de..658aa051593 100644
--- a/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
+++ b/frontend/src/app/features/in-app-notifications/bell/in-app-notification-bell.component.ts
@@ -23,6 +23,8 @@ export class InAppNotificationBellComponent implements OnInit {
unreadCountText$:Observable<number|string>;
+ public bellDisplayLimit = 99;
+
constructor(
readonly elementRef:ElementRef,
readonly storeService:IanBellService,
@@ -64,11 +66,7 @@ export class InAppNotificationBellComponent implements OnInit {
.unreadCount$
.pipe(
map((count) => {
- if (count > 99) {
- return '&bull;';
- }
-
- if (count <= 0) {
+ if (count > this.bellDisplayLimit || count <= 0) {
return '';
}
diff --git a/frontend/src/global_styles/common/header/app-header.sass b/frontend/src/global_styles/common/header/app-header.sass
index 07a911d6b9b..0bdff21e18a 100644
--- a/frontend/src/global_styles/common/header/app-header.sass
+++ b/frontend/src/global_styles/common/header/app-header.sass
@@ -48,10 +48,10 @@
&--end
grid-area: end
justify-content: flex-end
- padding-right: 10px
+ padding-right: 14px
.op-app-menu--item
- margin: 0 0.25rem
+ padding: 0 var(--control-medium-paddingBlock)
&--avatar
border: 1px solid var(--header-item-font-color)
diff --git a/lib/redmine/menu_manager/top_menu/quick_add_menu.rb b/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
index 47278afae6e..576e350173e 100644
--- a/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
@@ -46,9 +46,9 @@ module Redmine::MenuManager::TopMenu::QuickAddMenu
menu.with_show_button(scheme: :primary,
classes: "op-app-header--primer-button",
test_selector: "quick-add-menu-button",
- "aria-label": I18n.t("menus.quick_add.label"),
px: 2) do |button|
button.with_leading_visual_icon(icon: :plus)
+ button.with_tooltip(text: I18n.t("menus.quick_add.label"))
render(Primer::Beta::Octicon.new(icon: "triangle-down", aria: { label: I18n.t("menus.quick_add.label") }))
end
diff --git a/lib/redmine/menu_manager/top_menu/user_menu.rb b/lib/redmine/menu_manager/top_menu/user_menu.rb
index af46a1aa2b2..fc862fd7a80 100644
--- a/lib/redmine/menu_manager/top_menu/user_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/user_menu.rb
@@ -75,17 +75,19 @@ module Redmine::MenuManager::TopMenu::UserMenu
options = {
scheme: :invisible,
classes: "op-app-header--primer-button op-app-menu--item",
- test_selector: "op-app-header--user-menu-button",
- "aria-label": I18n.t("label_user_menu")
+ test_selector: "op-app-header--user-menu-button"
}
if User.current.logged?
if avatar.present?
- dialog.with_show_button(px: 0, **options) do
+ dialog.with_show_button(px: 0, **options) do |button|
+ button.with_tooltip(text: I18n.t("label_user_menu"))
avatar
end
else
- dialog.with_show_button(icon: :person, **options)
+ dialog.with_show_button(icon: :person, **options) do |button|
+ button.with_tooltip(text: I18n.t("label_user_menu"))
+ end
end
else
dialog.with_show_button(**options) do |button|
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 0d654e1c4f5..3424c52e168 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -99,14 +99,15 @@ module Redmine::MenuManager::TopMenuHelper
return "".html_safe unless User.current.logged?
return "".html_safe if Setting.notifications_hidden?
- render(Primer::Beta::Button.new(tag: :a,
- href: notifications_path,
- classes: "op-app-header--primer-button op-app-menu--item op-ian-bell",
- scheme: :invisible,
- test_selector: "op-ian-bell",
- p: 0,
- aria: { label: I18n.t("mail.notification.center") })) do
- concat(render(Primer::Beta::Octicon.new(icon: :inbox, aria: { label: I18n.t("mail.notification.center") })))
+ render(Primer::BaseComponent.new(tag: :div, classes: "op-app-menu--item", position: :relative)) do
+ concat(render(Primer::Beta::IconButton.new(icon: :inbox,
+ tag: :a,
+ href: notifications_path,
+ classes: "op-app-header--primer-button op-ian-bell",
+ scheme: :invisible,
+ test_selector: "op-ian-bell",
+ p: 0,
+ aria: { label: I18n.t("mail.notification.center") })))
concat(angular_component_tag("opce-in-app-notification-bell",
inputs: {
interval: Setting.notifications_polling_interval
diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rb
index 3ac4462a93e..4cf60a89a67 100644
--- a/spec/features/notifications/notification_center/notification_center_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_spec.rb
@@ -117,7 +117,7 @@ RSpec.describe "Notification center",
it "can dismiss all notifications of the currently selected filter" do
visit home_path
wait_for_reload
- center.expect_bell_count "•"
+ center.expect_bell_count ""
center.open
# side menu items show full count of notifications (inbox has two more due to the "Created" notification)
@@ -131,7 +131,7 @@ RSpec.describe "Notification center",
center.mark_all_read
wait_for_network_idle
- center.expect_bell_count "•"
+ center.expect_bell_count ""
side_menu.expect_item_with_count "Inbox", 152
side_menu.expect_item_with_count "Mentioned", 100
side_menu.expect_item_with_no_count "Watcher"
@@ -142,7 +142,7 @@ RSpec.describe "Notification center",
center.mark_all_read
wait_for_network_idle
- center.expect_bell_count "•"
+ center.expect_bell_count ""
side_menu.expect_item_with_count "Inbox", 101
side_menu.expect_item_with_count "Mentioned", 100
side_menu.expect_no_item project2.name