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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[65090] Migrate waffle icon from a normal menu to a overlapping lateral menu (#19595)
Behrokh Satarnejada20d953b3d79
diff --git a/app/views/custom_styles/_inline_css_logo.erb b/app/views/custom_styles/_inline_css_logo.erbindex 0195ea979c7..80925f04716 100644--- a/app/views/custom_styles/_inline_css_logo.erb+++ b/app/views/custom_styles/_inline_css_logo.erb@@ -37,6 +37,10 @@ See COPYRIGHT and LICENSE files for more details.asset_path("logo_openproject_white_big.png")end+ logo_icon_url = asset_path("icon_logo.svg")++ logo_icon_dark_url = asset_path("icon_logo_white.svg")+high_contrast_logo_url = if isRuasset_path("logo-black-bg-ua.png")else@@ -48,10 +52,14 @@ See COPYRIGHT and LICENSE files for more details.if apply_custom_styles?if CustomStyle.current.logo.present?logo_url = custom_style_logo_path(digest: CustomStyle.current.digest, filename: CustomStyle.current.logo_identifier)+ logo_icon_url = logo_url+ logo_icon_dark_url = logo_urlelsif CustomStyle.current.theme_logo.present?logo_url = asset_path(CustomStyle.current.theme_logo)+ logo_icon_url = logo_url+ logo_icon_dark_url = logo_urlend-+if isRu && logo_url == asset_path("logo_openproject.png")logo_url = asset_path("logo-black-bg-ua.png")end@@ -62,6 +70,14 @@ See COPYRIGHT and LICENSE files for more details.background-image: url(<%= logo_url %>);}+ .op-logo-icon {+ background-image: url(<%= logo_icon_url %>);+ }++ .op-logo-icon_dark {+ background-image: url(<%= logo_icon_dark_url %>);+ }+.op-logo--link_high_contrast {background-image: url(<%= OpenProject::Configuration.bim? ? high_contrast_bim_logo_url : high_contrast_logo_url %>);}diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 56ae1031ae8..87eba4c6de0 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -72,6 +72,22 @@ Redmine::MenuManager.map :top_menu do |menu|html: { accesskey: OpenProject::AccessKeys.key_for(:help),title: I18n.t("label_help"),target: "_blank" }++ menu.push :home,+ { controller: "/homescreen", action: "index" },+ context: :my,+ icon: "home",+ first: true++ menu.push :my_page,+ { controller: "/my/page", action: "show" },+ context: :my,+ after: :home,+ icon: "person",+ caption: I18n.t("my_page.label"),+ if: ->(*) do+ User.current.logged?+ endendRedmine::MenuManager.map :quick_add_menu do |menu|diff --git a/frontend/src/global_styles/common/header/app-menu.sass b/frontend/src/global_styles/common/header/app-menu.sassindex 46a71c06dd0..738a0d15048 100644--- a/frontend/src/global_styles/common/header/app-menu.sass+++ b/frontend/src/global_styles/common/header/app-menu.sass@@ -11,6 +11,9 @@height: 100%min-width: 0px+ &--items+ margin-left: 0+&--item-dropdown-indicatordisplay: inline-flexjustify-content: centerdiff --git a/frontend/src/global_styles/common/header/logo.sass b/frontend/src/global_styles/common/header/logo.sassindex b0248d7dfa0..b6e3732d00f 100644--- a/frontend/src/global_styles/common/header/logo.sass+++ b/frontend/src/global_styles/common/header/logo.sass@@ -12,5 +12,11 @@background: no-repeat centerbackground-size: contain+ &-icon, &-icon_dark+ margin-left: 0.5rem+ height: 32px+ background: no-repeat left center+ background-size: contain+@media screen and (max-width: 850px)display: nonediff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rbindex c9d97dda131..74792857e74 100644--- a/lib/redmine/menu_manager/top_menu_helper.rb+++ b/lib/redmine/menu_manager/top_menu_helper.rb@@ -56,6 +56,11 @@ module Redmine::MenuManager::TopMenuHelperendend+ def render_logo_icon+ mode_class = User.current.pref.theme === "dark" ? "op-logo-icon_dark" : "op-logo-icon"+ render Primer::BaseComponent.new(tag: :div, classes: mode_class)+ end+def render_top_menu_searchcontent_tag :div, class: "op-app-search" dorender_global_search_input@@ -174,35 +179,57 @@ module Redmine::MenuManager::TopMenuHelperdef render_module_top_menu_node(item_groups = module_top_menu_item_groups)unless item_groups.empty?- render Primer::Alpha::ActionMenu.new(classes: "op-app-menu--item",- menu_id: "op-app-header--modules-menu",- anchor_align: :end) do |menu|- menu.with_show_button(icon: "op-grid-menu",- scheme: :invisible,- classes: "op-app-menu--item-action op-app-header--primer-button",- title: I18n.t("label_modules"),- test_selector: "op-app-header--modules-menu-button",- "aria-label": I18n.t("label_modules"))+ render Primer::Alpha::Dialog.new(classes: "op-app-menu--item",+ title: I18n.t("label_modules"),+ visually_hide_title: true,+ size: :small,+ menu_id: "op-app-header--modules-menu",+ position: :left) do |dialog|+ dialog.with_show_button(icon: "op-grid-menu",+ scheme: :invisible,+ classes: "op-app-menu--item-action op-app-header--primer-button",+ title: I18n.t("label_modules"),+ test_selector: "op-app-header--modules-menu-button",+ "aria-controls": "op-app-header--modules-menu-list",+ "aria-label": I18n.t("label_modules"))+ dialog.with_header(classes: "op-app-header--modules-menu-header") do+ render_logo_icon+ enditem_groups.each do |item_group|- render_menu_item_group(menu, item_group)+ render_dialog_item_group(dialog, item_group)endendendend- def render_menu_item_group(menu, item_group)- menu.with_group do |menu_group|- menu_group.with_heading(title: item_group[:title], align_items: :flex_start) if item_group[:title]-- item_group[:items].each do |item|- menu_group.with_item(- href: url_for(item.url),- label: item.caption,- test_selector: "op-menu--item-action"- ) do |menu_item|- menu_item.with_leading_visual_icon(icon: item.icon) if item.icon- end+ def render_dialog_item_group(dialog, item_group)+ dialog.with_body do+ render Primer::Alpha::ActionList.new(+ classes: "op-app-menu--items",+ id: "op-app-header--modules-menu-list"+ ) do |list|+ list.with_heading(title: item_group[:title], align_items: :flex_start) if item_group[:title]++ my_items, remaining_items = item_group[:items].partition { |item| item.context == :my }++ render_action_list_items(list, my_items)++ list.with_divider if my_items.any? && remaining_items.any?++ render_action_list_items(list, remaining_items)+ end+ end+ end++ def render_action_list_items(list, items)+ items.each do |item|+ list.with_item(+ href: url_for(item.url),+ label: item.caption,+ test_selector: "op-menu--item-action"+ ) do |menu_item|+ menu_item.with_leading_visual_icon(icon: item.icon) if item.iconendendend@@ -220,7 +247,8 @@ module Redmine::MenuManager::TopMenuHelper# Menu items for the modules top menudef more_top_menu_items- split_top_menu_into_main_or_more_menus[:modules]+ split = split_top_menu_into_main_or_more_menus+ split[:modules] + split[:my]enddef module_top_menu_item_groupsdiff --git a/modules/costs/lib/costs/engine.rb b/modules/costs/lib/costs/engine.rbindex 52ae26593e4..99067fe8b73 100644--- a/modules/costs/lib/costs/engine.rb+++ b/modules/costs/lib/costs/engine.rb@@ -151,6 +151,17 @@ module CostsUser.current.allowed_in_any_project?(:log_own_time) || User.current.allowed_in_any_project?(:log_time)end,icon: :stopwatch++ menu :top_menu,+ :my_time_tracking,+ { controller: "/my/time_tracking", action: "index" },+ after: :my_page,+ context: :my,+ caption: :label_my_time_tracking,+ if: ->(*) do+ User.current.allowed_in_any_project?(:log_own_time) || User.current.allowed_in_any_project?(:log_time)+ end,+ icon: :stopwatchendinitializer "costs.settings" dodiff --git a/spec/features/menu_items/top_menu_item_spec.rb b/spec/features/menu_items/top_menu_item_spec.rbindex 04220be9186..0a0387c9ec6 100644--- a/spec/features/menu_items/top_menu_item_spec.rb+++ b/spec/features/menu_items/top_menu_item_spec.rb@@ -82,6 +82,9 @@ RSpec.describe "Top menu items", :js doshared_let(:news_item) { menu_link_item.new(I18n.t(:label_news_plural), news_index_path) }shared_let(:reporting_item) { menu_link_item.new(I18n.t(:cost_reports_title), "/cost_reports") }shared_let(:meetings_item) { menu_link_item.new(I18n.t(:label_meeting_plural), "/meetings") }+ shared_let(:my_page_item) { menu_link_item.new(I18n.t("my_page.label"), my_page_path) }+ shared_let(:home_item) { menu_link_item.new(I18n.t(:label_home), home_path) }+ shared_let(:my_time_tracking_item) { menu_link_item.new(I18n.t(:label_my_time_tracking), "/my/time-tracking") }shared_let(:all_items) do[@@ -93,7 +96,10 @@ RSpec.describe "Top menu items", :js doboards_item,news_item,reporting_item,- meetings_item+ meetings_item,+ my_page_item,+ home_item,+ my_time_tracking_item]end@@ -122,8 +128,8 @@ RSpec.describe "Top menu items", :js doendcontext "as a regular user" do- it "only displays projects, activity and news" do- has_menu_items? project_item, activity_item, news_item+ it "only displays projects, activity, news, my page and home" do+ has_menu_items? project_item, activity_item, news_item, home_item, my_page_itemendend@@ -147,8 +153,8 @@ RSpec.describe "Top menu items", :js doendcontext "when not login_required", with_settings: { login_required: false } do- it "displays only projects, activity and news" do- has_menu_items? project_item, activity_item, news_item+ it "displays only projects, activity, news and home" do+ has_menu_items? project_item, activity_item, news_item, home_itemendendend