Files
redmine/patches/uxupgrade_logo.patch
Roman Vaníček f1e28f6fc1
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
FIX Logo web path.
2023-03-28 23:23:56 +02:00

70 lines
3.7 KiB
Diff

--- a/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade.rb
+++ b/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade.rb
@@ -41,10 +41,10 @@ module RedmineXUxUpgrade
logo = settings.attachments.where(description: 'logo')&.last
redmine_x_ux_theme_path = File.join(Rails.root, 'public', 'themes', 'redminex_theme', 'images')
- path_to_logo = "#{redmine_x_ux_theme_path}/#{logo.disk_filename}" if logo
+ path_to_logo = "#{redmine_x_ux_theme_path}/logo.png" if logo
if path_to_logo && File.exist?(path_to_logo)
- return ActionController::Base.helpers.asset_path("#{Redmine::Utils::relative_url_root}/themes/redminex_theme/images/#{logo.disk_filename}", :plugin => '000_redmine_x_ux_upgrade')
+ return ActionController::Base.helpers.asset_path("#{Redmine::Utils::relative_url_root}/themes/redminex_theme/images/logo.png", :plugin => '000_redmine_x_ux_upgrade')
end
#default logo if not set
--- a/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade/ux_upgrade_attachments.rb
+++ b/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade/ux_upgrade_attachments.rb
@@ -13,6 +13,7 @@ module RedmineXUxUpgrade
LOGIN_NAME = 'login'
LOGIN_DESKTOP_NAME = 'login_desktop'
LOGIN_MOBILE_NAME = 'login_mobile'
+ LOGO_FILE = 'logo.png'
LOGIN_DESKTOP_FILE = 'login-2k.jpg'
LOGIN_MOBILE_FILE = 'login.jpg'
@@ -141,8 +142,6 @@ module RedmineXUxUpgrade
return unless old_attachment
if name == LOGO_NAME
- path_to_logo = image_path(name, old_attachment.disk_filename)
- File.delete(path_to_logo) if path_to_logo && File.exist?(path_to_logo)
else
FileUtils.cp_r(default_image_path(name), image_path(name))
end
@@ -153,10 +152,8 @@ module RedmineXUxUpgrade
# @param [String | nil] filename - name of the filename of the logo file
# @return [String] - path to file corresponding to the given name
def self.image_path(name, filename=nil)
- if name == LOGO_NAME && filename
- File.join(Rails.root, 'public', 'themes', 'redminex_theme', 'images', filename)
- elsif name == LOGO_NAME && filename.nil?
- File.join(Rails.root, 'public', 'themes', 'redminex_theme', 'images')
+ if name == LOGO_NAME
+ File.join(Rails.root, 'public', 'themes', 'redminex_theme', 'images', LOGO_FILE)
elsif name == LOGIN_DESKTOP_NAME
File.join(Rails.root, 'public', 'themes', 'redminex_theme', 'images', LOGIN_DESKTOP_FILE)
elsif name == LOGIN_MOBILE_NAME
--- a/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade/application_helper_patch.rb
+++ b/plugins/000_redmine_x_ux_upgrade/lib/redmine_x_ux_upgrade/application_helper_patch.rb
@@ -70,19 +70,6 @@ module RedmineXUxUpgrade
super *sources, options
end
- # Redefined - line 1723
- def favicon
- favicon_path = "#{Redmine::Utils::relative_url_root}/themes/redminex_theme/images/favicon"
-
- "<link rel='apple-touch-icon' sizes='180x180' href='#{favicon_path}/apple-touch-icon.png'>
- <link rel='icon' type='image/png' sizes='32x32' href='#{favicon_path}/favicon-32x32.png'>
- <link rel='icon' type='image/png' sizes='16x16' href='#{favicon_path}/favicon-16x16.png'>
- <link rel='manifest' href='#{favicon_path}/site.webmanifest'>
- <link rel='mask-icon' href='#{favicon_path}/safari-pinned-tab.svg' color='#5bbad5'>
- <link rel='shortcut icon' href='#{favicon_path}/favicon.ico'> <meta name='msapplication-TileColor' content='#ffffff'>
- <meta name='theme-color' content='#ffffff'>".html_safe
- end
-
# ***************
# * New methods *
# ***************