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
Create CustomStyle if it does not exist yet
Henriette Dingerf60610ff2bf7
diff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rbindex ea8457624f0..32028a78763 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+ @custom_style = CustomStyle.current || CustomStyle.create!if @custom_style.update(custom_style_params)redirect_to custom_style_pathelse@@ -121,7 +121,7 @@ class CustomStylesController < ApplicationControllerenddef set_logo(logo)- CustomStyle.current.update(theme_logo: logo)+ (CustomStyle.current || CustomStyle.create!).update(theme_logo: logo)enddef set_colors(variable_params)@@ -144,7 +144,7 @@ class CustomStylesController < ApplicationControllerdef set_theme(params)theme = ActionController::Parameters.new(theme: params[:theme] || '').permit(:theme)- @custom_style = CustomStyle.current+ @custom_style = (CustomStyle.current || CustomStyle.create!)@custom_style.update(theme)end