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

Render the notification button itself as a Primer button

Henriette Darge3628bb64ef23
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 40866562d9a..6afbc9da8b3 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,15 +1,8 @@
-<a
- class="op-ian-bell op-app-menu--item-action"
- data-test-selector="op-ian-bell"
- [href]="notificationsPath()"
->
- <svg bell-fill-icon size="small"></svg>
<ng-container *ngIf="(unreadCount$ | async) as unreadCount">
<span
*ngIf="unreadCount !== 0"
class="op-ian-bell--indicator"
data-test-selector="op-ian-notifications-count"
- [textContent]="unreadCountText$ | async"
+ [innerHTML]="unreadCountText$ | async"
></span>
</ng-container>
-</a>
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 92eb2b97ea7..676f6bd271f 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,6 @@
&--indicator
@include indicator-bubble
position: absolute
- top: 10px
- right: 3px
+ top: 0
+ right: -4px
background: var(--display-red-bgColor-emphasis)
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 a3949cfd073..3e549358238 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
@@ -7,7 +7,6 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import { IanBellService } from 'core-app/features/in-app-notifications/bell/state/ian-bell.service';
import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
-
@Component({
selector: 'opce-in-app-notification-bell',
templateUrl: './in-app-notification-bell.component.html',
@@ -65,7 +64,7 @@ export class InAppNotificationBellComponent implements OnInit {
.pipe(
map((count) => {
if (count > 99) {
- return '99+';
+ return '&bull;';
}
if (count <= 0) {
@@ -76,8 +75,4 @@ export class InAppNotificationBellComponent implements OnInit {
}),
);
}
-
- notificationsPath():string {
- return this.pathHelper.notificationsPath();
- }
}
diff --git a/frontend/src/app/shared/components/icon/icon.module.ts b/frontend/src/app/shared/components/icon/icon.module.ts
index db9f19a2dff..529ee12d4fd 100644
--- a/frontend/src/app/shared/components/icon/icon.module.ts
+++ b/frontend/src/app/shared/components/icon/icon.module.ts
@@ -33,7 +33,6 @@ import {
StarFillIconComponent,
StarIconComponent,
XIconComponent,
- BellFillIconComponent,
OpGitlabIssueClosedIconComponent,
OpGitlabLabelsIconComponent,
OpGitlabIssueOpenIconComponent,
@@ -95,7 +94,6 @@ import {
StarFillIconComponent,
StarIconComponent,
XIconComponent,
- BellFillIconComponent,
OpGitlabIssueClosedIconComponent,
OpGitlabLabelsIconComponent,
@@ -162,7 +160,6 @@ import {
StarFillIconComponent,
StarIconComponent,
XIconComponent,
- BellFillIconComponent,
OpGitlabIssueOpenIconComponent,
OpGitlabIssueClosedIconComponent,
diff --git a/frontend/src/global_styles/common/header/app-header.sass b/frontend/src/global_styles/common/header/app-header.sass
index c77c0379d33..07a911d6b9b 100644
--- a/frontend/src/global_styles/common/header/app-header.sass
+++ b/frontend/src/global_styles/common/header/app-header.sass
@@ -48,6 +48,10 @@
&--end
grid-area: end
justify-content: flex-end
+ padding-right: 10px
+
+ .op-app-menu--item
+ margin: 0 0.25rem
&--avatar
border: 1px solid var(--header-item-font-color)
diff --git a/frontend/src/global_styles/primer/_overrides.sass b/frontend/src/global_styles/primer/_overrides.sass
index 43e9799670f..4f465f527c2 100644
--- a/frontend/src/global_styles/primer/_overrides.sass
+++ b/frontend/src/global_styles/primer/_overrides.sass
@@ -89,6 +89,9 @@ ul.SegmentedControl,
align-self: center
color: var(--header-item-font-color)
+.Button.op-app-header--primer-button
+ min-width: var(--control-medium-size)
+
&:hover
color: var(--header-item-font-hover-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 2c0ca16b06a..97f06745ead 100644
--- a/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/quick_add_menu.rb
@@ -53,7 +53,7 @@ module Redmine::MenuManager::TopMenu::QuickAddMenu
end
add_first_level_items(menu)
- if first_level_menu_items_for(:quick_add_menu, @project).any? && work_package_quick_add_items.any?
+ if first_level_menu_items_for(:quick_add_menu, @project).present? && work_package_quick_add_items.present?
menu.with_divider
end
add_second_level_items(menu)
diff --git a/lib/redmine/menu_manager/top_menu/user_menu.rb b/lib/redmine/menu_manager/top_menu/user_menu.rb
index 72d72cd7909..255a3ef2a2a 100644
--- a/lib/redmine/menu_manager/top_menu/user_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/user_menu.rb
@@ -53,13 +53,10 @@ module Redmine::MenuManager::TopMenu::UserMenu
render Primer::Alpha::Dialog.new(title: I18n.t("label_user_menu"),
visually_hide_title: true,
+ size: User.current.logged? ? :small : :medium,
position: :right) do |dialog|
- dialog.with_show_button(scheme: :invisible,
- classes: "op-app-header--primer-button op-app-menu--item op-top-menu-user",
- test_selector: "op-app-header--modules-menu-button",
- "aria-label": I18n.t("label_user_menu")) do
- lateral_user_menu_button(avatar)
- end
+ lateral_user_menu_button(dialog, avatar)
+
dialog.with_header(classes: "op-app-header--modules-menu-header") do
lateral_user_menu_header(avatar)
@@ -75,18 +72,27 @@ module Redmine::MenuManager::TopMenu::UserMenu
end
end
- def lateral_user_menu_button(avatar)
- if User.current.logged? && avatar.present?
- avatar
+ def lateral_user_menu_button(dialog, avatar)
+ options = {
+ scheme: :invisible,
+ classes: "op-app-header--primer-button op-app-menu--item op-top-menu-user",
+ test_selector: "op-app-header--modules-menu-button",
+ "aria-label": I18n.t("label_user_menu")
+ }
+
+ if show_avatar?(avatar)
+ dialog.with_show_button(px: 0, **options) do
+ avatar
+ end
else
- render(Primer::Beta::Octicon.new(icon: :person, aria: { label: I18n.t("label_user_menu") }))
+ dialog.with_show_button(icon: :person, **options)
end
end
def lateral_user_menu_header(avatar)
render(Primer::OpenProject::FlexLayout.new(align_items: :center)) do |flex|
flex.with_column(mr: 2) do
- if User.current.logged? && avatar.present?
+ if show_avatar?(avatar)
avatar
else
render(Primer::Beta::Octicon.new(icon: :person, aria: { label: I18n.t("label_user_menu") }))
@@ -114,13 +120,13 @@ module Redmine::MenuManager::TopMenu::UserMenu
) do |list|
list.with_divider
- add_lateral_user_menu_items link_items
+ add_lateral_user_menu_items list, link_items
end
end
end
end
- def add_lateral_user_menu_items(link_items)
+ def add_lateral_user_menu_items(list, link_items)
link_items.each do |item|
list.with_item(
href: allowed_node_url(item, nil),
@@ -143,4 +149,8 @@ module Redmine::MenuManager::TopMenu::UserMenu
render partial:
end
+
+ def show_avatar?(avatar)
+ User.current.logged? && avatar.present?
+ end
end
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index 3cf1388defd..e414a72a490 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -93,11 +93,18 @@ module Redmine::MenuManager::TopMenuHelper
return "".html_safe unless User.current.logged?
return "".html_safe if Setting.notifications_hidden?
- content_tag("li", class: "op-app-menu--item", title: I18n.t("mail.notification.center")) do
- angular_component_tag "opce-in-app-notification-bell",
- inputs: {
- interval: Setting.notifications_polling_interval
- }
+ 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") })))
+ concat(angular_component_tag("opce-in-app-notification-bell",
+ inputs: {
+ interval: Setting.notifications_polling_interval
+ }))
end
end