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

Add migration to change the default value of the primary-button in BIM instances to the primer green

Henriette Darged4d966ecd968
diff --git a/db/migrate/20240408093541_change_default_value_for_bim_primary_color.rb b/db/migrate/20240408093541_change_default_value_for_bim_primary_color.rb
new file mode 100644
index 00000000000..6a5f5f30de6
--- /dev/null
+++ b/db/migrate/20240408093541_change_default_value_for_bim_primary_color.rb
@@ -0,0 +1,19 @@
+class ChangeDefaultValueForBimPrimaryColor < ActiveRecord::Migration[7.1]
+ class MigrationDesignColor < ApplicationRecord
+ self.table_name = "design_colors"
+ end
+
+ def up
+ primary_button_color = MigrationDesignColor.find_by(variable: "primary-button-color")
+ if primary_button_color&.hexcode == OpenProject::CustomStyles::ColorThemes::DEPRECATED_BIM_ALTERNATIVE_COLOR
+ primary_button_color.update(hexcode: OpenProject::CustomStyles::ColorThemes::PRIMER_PRIMARY_BUTTON_COLOR)
+ end
+ end
+
+ def down
+ primary_button_color = MigrationDesignColor.find_by(variable: "primary-button-color")
+ if primary_button_color&.hexcode == OpenProject::CustomStyles::ColorThemes::PRIMER_PRIMARY_BUTTON_COLOR
+ primary_button_color.update(hexcode: OpenProject::CustomStyles::ColorThemes::DEPRECATED_BIM_ALTERNATIVE_COLOR)
+ end
+ end
+end
diff --git a/lib/open_project/custom_styles/color_themes.rb b/lib/open_project/custom_styles/color_themes.rb
index 9aba8b295ec..1664a7c1dee 100644
--- a/lib/open_project/custom_styles/color_themes.rb
+++ b/lib/open_project/custom_styles/color_themes.rb
@@ -33,6 +33,7 @@ module OpenProject::CustomStyles
OpenProject::CustomStyles::ColorThemes::DEFAULT_THEME_NAME = "OpenProject".freeze
DEPRECATED_ALTERNATIVE_COLOR = "#35C53F".freeze
+ DEPRECATED_BIM_ALTERNATIVE_COLOR = "#349939".freeze
DEPRECATED_PRIMARY_COLOR = "#1A67A3".freeze
DEPRECATED_PRIMARY_DARK_COLOR = "#175A8E".freeze
PRIMER_PRIMARY_BUTTON_COLOR = "#1F883D".freeze