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
Extract custom style functionality to separate method
Henriette Dinger33899ae8e610
diff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rbindex 32028a78763..c996aac0c9b 100644--- a/app/controllers/custom_styles_controller.rb+++ b/app/controllers/custom_styles_controller.rb@@ -54,7 +54,7 @@ class CustomStylesController < ApplicationControllerenddef update- @custom_style = CustomStyle.current || CustomStyle.create!+ @custom_style = get_or_create_custom_styleif @custom_style.update(custom_style_params)redirect_to custom_style_pathelse@@ -121,7 +121,7 @@ class CustomStylesController < ApplicationControllerenddef set_logo(logo)- (CustomStyle.current || CustomStyle.create!).update(theme_logo: logo)+ get_or_create_custom_style.update(theme_logo: logo)enddef set_colors(variable_params)@@ -144,10 +144,14 @@ class CustomStylesController < ApplicationControllerdef set_theme(params)theme = ActionController::Parameters.new(theme: params[:theme] || '').permit(:theme)- @custom_style = (CustomStyle.current || CustomStyle.create!)+ @custom_style = get_or_create_custom_style@custom_style.update(theme)end+ def get_or_create_custom_style+ CustomStyle.current || CustomStyle.create!+ end+def require_ee_tokenunless EnterpriseToken.allows_to?(:define_custom_style)redirect_to custom_style_upsale_path