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

[66026] Add the OpenProject logo in the mobile header (#19711)

Behrokh Satarnejad5738da779abd
diff --git a/app/helpers/custom_styles_helper.rb b/app/helpers/custom_styles_helper.rb
index f3e0716c747..5a47f61e1d8 100644
--- a/app/helpers/custom_styles_helper.rb
+++ b/app/helpers/custom_styles_helper.rb
@@ -58,6 +58,11 @@ module CustomStylesHelper
(EnterpriseToken.allows_to?(:define_custom_style) || skip_ee_check)
end
+ def custom_logo?
+ CustomStyle.current.present? &&
+ (CustomStyle.current.logo.present? || CustomStyle.current.theme_logo.present?)
+ end
+
# The default favicon and touch icons are both the same for normal OP and BIM.
def apply_custom_favicon?
apply_custom_styles?(skip_ee_check: false) && CustomStyle.current.favicon.present?
diff --git a/app/views/custom_styles/_inline_css_logo.erb b/app/views/custom_styles/_inline_css_logo.erb
index 80925f04716..a64eab4336d 100644
--- a/app/views/custom_styles/_inline_css_logo.erb
+++ b/app/views/custom_styles/_inline_css_logo.erb
@@ -39,7 +39,7 @@ See COPYRIGHT and LICENSE files for more details.
logo_icon_url = asset_path("icon_logo.svg")
- logo_icon_dark_url = asset_path("icon_logo_white.svg")
+ logo_icon_white_url = asset_path("icon_logo_white.svg")
high_contrast_logo_url = if isRu
asset_path("logo-black-bg-ua.png")
@@ -52,12 +52,8 @@ 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_url
elsif CustomStyle.current.theme_logo.present?
logo_url = asset_path(CustomStyle.current.theme_logo)
- logo_icon_url = logo_url
- logo_icon_dark_url = logo_url
end
if isRu && logo_url == asset_path("logo_openproject.png")
@@ -70,12 +66,12 @@ See COPYRIGHT and LICENSE files for more details.
background-image: url(<%= logo_url %>);
}
- .op-logo-icon {
+ .op-logo--icon {
background-image: url(<%= logo_icon_url %>);
}
- .op-logo-icon_dark {
- background-image: url(<%= logo_icon_dark_url %>);
+ .op-logo--icon_white {
+ background-image: url(<%= logo_icon_white_url %>);
}
.op-logo--link_high_contrast {
diff --git a/frontend/src/global_styles/common/header/app-header.sass b/frontend/src/global_styles/common/header/app-header.sass
index 2f39fda7fe1..de963eef605 100644
--- a/frontend/src/global_styles/common/header/app-header.sass
+++ b/frontend/src/global_styles/common/header/app-header.sass
@@ -56,6 +56,11 @@
&--avatar
border: 1px solid var(--header-item-font-color)
+ &--modules-menu-header
+ .op-logo
+ display: block
+ height: 32px
+ width: 32px
._header-scrolled &
@media screen and (max-width: $breakpoint-sm)
diff --git a/frontend/src/global_styles/common/header/logo.sass b/frontend/src/global_styles/common/header/logo.sass
index b6e3732d00f..0f579843c2b 100644
--- a/frontend/src/global_styles/common/header/logo.sass
+++ b/frontend/src/global_styles/common/header/logo.sass
@@ -12,11 +12,15 @@
background: no-repeat center
background-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: none
+
+ &--icon
+ display: none
+ background-repeat: no-repeat
+ background-position: left center
+ background-size: contain
+ @media screen and (max-width: 850px)
+ display: block
+ height: 24px
+ width: 24px
diff --git a/lib/redmine/menu_manager/top_menu/module_menu.rb b/lib/redmine/menu_manager/top_menu/module_menu.rb
index 7487c160354..ab39474b242 100644
--- a/lib/redmine/menu_manager/top_menu/module_menu.rb
+++ b/lib/redmine/menu_manager/top_menu/module_menu.rb
@@ -43,7 +43,7 @@ module Redmine::MenuManager::TopMenu::ModuleMenu
"aria-controls": "op-app-header--modules-menu-list",
"aria-label": I18n.t("label_global_modules"))
dialog.with_header(classes: "op-app-header--modules-menu-header") do
- render_logo_icon
+ render_waffle_menu_logo_icon unless custom_logo?
end
item_groups.each do |item_group|
diff --git a/lib/redmine/menu_manager/top_menu_helper.rb b/lib/redmine/menu_manager/top_menu_helper.rb
index e25aee41997..d42a07ec3a9 100644
--- a/lib/redmine/menu_manager/top_menu_helper.rb
+++ b/lib/redmine/menu_manager/top_menu_helper.rb
@@ -42,8 +42,12 @@ module Redmine::MenuManager::TopMenuHelper
end
def top_menu_left_menu_items
- [render_module_top_menu_node,
- render_logo]
+ items = [
+ render_module_top_menu_node,
+ render_logo
+ ]
+ items << render_logo_icon unless custom_logo?
+ items
end
def render_top_menu_center
@@ -60,8 +64,13 @@ module Redmine::MenuManager::TopMenuHelper
end
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)
+ mode_class = "op-logo--icon_white" unless User.current.pref.high_contrast_theme?
+ link_to(I18n.t("label_home"), configurable_home_url, class: ["op-logo", "op-logo--icon", "op-logo--link", mode_class])
+ end
+
+ def render_waffle_menu_logo_icon
+ mode_class = User.current.pref.theme === "dark" ? "op-logo--icon_white" : "op-logo--icon"
+ render Primer::BaseComponent.new(tag: :div, classes: ["op-logo", mode_class])
end
def render_top_menu_search