Files
Behrokh Satarnejad 701103240a [68323] Custom logo for mobile (#21059)
* add a migration to upload custom mobile logo

* add a new route for uploading nd removing mobile logo

* show custom logo in header

* Add a feature spec

* Update custom_style.rb

* Show mobile icon for desktop when there is no desktop logo

* show icon logo in waffle menu modal

* Show logo icon when a custom mobile logo exists or when no custom desktop logo is uploaded
2025-11-21 11:25:57 +01:00

95 lines
3.0 KiB
Plaintext

<%#-- copyright
OpenProject is an open source project management software.
Copyright (C) the OpenProject GmbH
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 3.
OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
Copyright (C) 2006-2013 Jean-Philippe Lang
Copyright (C) 2010-2013 the ChiliProject Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
<style type="text/css">
<%
is_ru = I18n.locale == :ru
cs = apply_custom_styles? ? CustomStyle.current : nil
logo_url = if is_ru
asset_path("logo-white-bg-ua.png")
else
asset_path("logo_openproject_white_big.png")
end
high_contrast_logo_url = if is_ru
asset_path("logo-black-bg-ua.png")
else
asset_path("logo_openproject.png")
end
logo_icon_url = asset_path("icon_logo.svg")
logo_icon_white_url = asset_path("icon_logo_white.svg")
high_contrast_bim_logo_url = asset_path("bim/logo_openproject_bim_big_coloured.png")
if cs
has_logo = cs.logo.present?
has_logo_mobile = cs.logo_mobile.present?
if has_logo
logo_url = high_contrast_logo_url = custom_style_logo_path(digest: cs.digest, filename: cs.logo_identifier)
elsif has_logo_mobile
logo_url = high_contrast_logo_url = custom_style_logo_mobile_path(digest: cs.digest, filename: cs.logo_mobile_identifier)
elsif cs.theme_logo.present?
logo_url = asset_path(cs.theme_logo)
end
if is_ru && logo_url == asset_path("logo_openproject.png")
logo_url = asset_path("logo-black-bg-ua.png")
end
if has_logo_mobile
mobile_logo_url = custom_style_logo_mobile_path(
digest: cs.digest,
filename: cs.logo_mobile_identifier
)
logo_icon_url = mobile_logo_url
logo_icon_white_url = mobile_logo_url
end
end
%>
.op-logo--link {
background-image: url(<%= logo_url %>);
}
.op-logo--icon {
background-image: url(<%= logo_icon_url %>);
}
.op-logo--icon_white {
background-image: url(<%= logo_icon_white_url %>);
}
.op-logo--link_high_contrast {
background-image: url(<%= OpenProject::Configuration.bim? ? high_contrast_bim_logo_url : high_contrast_logo_url %>);
}
</style>