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
Fix the design patch to respond to bim config
Oliver Güntherb259e2051ec6
diff --git a/lib/open_project/custom_styles/design.rb b/lib/open_project/custom_styles/design.rbindex 085fdb79fab..94131b140c8 100644--- a/lib/open_project/custom_styles/design.rb+++ b/lib/open_project/custom_styles/design.rb@@ -246,16 +246,16 @@ module OpenProject::CustomStyles### Return the value after resolving all variables to values.def self.resolved_variables- resolved_variables = DEFAULTS.dup+ resolved_variables = variables.dup- DEFAULTS.each do |var_name, value|+ variables.each do |var_name, value|resolved_variables[var_name] = resolve_value(value)endresolved_variablesenddef self.resolve_value(variable_value)- variable_value.gsub(VARIABLE_NAME_RGX) { resolve_value(DEFAULTS[$1]) }+ variable_value.gsub(VARIABLE_NAME_RGX) { resolve_value(variables[$1]) }end##diff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rbindex a3291b539b4..edd4b0b530b 100644--- a/modules/bim/lib/open_project/bim/engine.rb+++ b/modules/bim/lib/open_project/bim/engine.rb@@ -87,6 +87,7 @@ module OpenProject::Bimpatches %i[WorkPackage Type Journal RootSeeder Project]+ patch_with_namespace :OpenProject, :CustomStyles, :Designpatch_with_namespace :BasicData, :SettingSeederpatch_with_namespace :BasicData, :RoleSeederpatch_with_namespace :API, :V3, :Activities, :ActivityRepresenter@@ -161,10 +162,6 @@ module OpenProject::Bimconfig.to_prepare dorequire_relative 'hooks'-- # The DesignPatch is not a typical method patch, as it replaces a constant and thus needs to be applied without the- # standard patch logic for plugins.- require_relative "patches/design_patch"endinitializer 'bim.bcf.register_hooks' dodiff --git a/modules/bim/lib/open_project/bim/patches/design_patch.rb b/modules/bim/lib/open_project/bim/patches/design_patch.rbindex 9c3cf67aeae..dd14e86b45d 100644--- a/modules/bim/lib/open_project/bim/patches/design_patch.rb+++ b/modules/bim/lib/open_project/bim/patches/design_patch.rb@@ -3,24 +3,31 @@ require 'open_project/custom_styles/design'module OpenProject::Bimmodule Patchesmodule DesignPatch- DEFAULTS = OpenProject::CustomStyles::Design::DEFAULTS.merge(- {- 'primary-color' => "#3270DB",- 'primary-color-dark' => "#163473",- 'alternative-color' => "#349939",- 'header-bg-color' => "#05002C",- 'header-item-bg-hover-color' => "#163473",- 'content-link-color' => "#275BB5",- 'main-menu-bg-color' => "#0E2045",- 'main-menu-bg-selected-background' => "#3270DB",- 'main-menu-bg-hover-background' => "#163473",- 'header-home-link-bg' => '#{image-url("bim/logo_openproject_bim_big.png") no-repeat 20px 0}',- 'new-feature-teaser-image' => '#{image-url("bim/new_feature_teaser.jpg")}'- }- ).freeze+ def self.included(base)+ class << base+ prepend ClassMethods+ end+ end++ module ClassMethods+ def variables+ if OpenProject::Configuration.bim?+ super.merge 'primary-color' => "#3270DB",+ 'primary-color-dark' => "#163473",+ 'alternative-color' => "#349939",+ 'header-bg-color' => "#05002C",+ 'header-item-bg-hover-color' => "#163473",+ 'content-link-color' => "#275BB5",+ 'main-menu-bg-color' => "#0E2045",+ 'main-menu-bg-selected-background' => "#3270DB",+ 'main-menu-bg-hover-background' => "#163473",+ 'header-home-link-bg' => '#{image-url("bim/logo_openproject_bim_big.png") no-repeat 20px 0}',+ 'new-feature-teaser-image' => '#{image-url("bim/new_feature_teaser.jpg")}'+ else+ super+ end+ end+ endendendend--OpenProject::CustomStyles::Design.send(:remove_const, 'DEFAULTS')-OpenProject::CustomStyles::Design.const_set('DEFAULTS', OpenProject::Bim::Patches::DesignPatch::DEFAULTS)