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

fix rubocup warning and some spacing

Behrokh Satarnejade1bfea1eb16e
diff --git a/app/controllers/custom_styles_controller.rb b/app/controllers/custom_styles_controller.rb
index 984cb9094a6..78d2e836bf5 100644
--- a/app/controllers/custom_styles_controller.rb
+++ b/app/controllers/custom_styles_controller.rb
@@ -47,10 +47,12 @@ class CustomStylesController < ApplicationController
def default_url_options
super.merge(tab: params[:tab])
end
+
def show
@custom_style = CustomStyle.current || CustomStyle.new
@current_theme = @custom_style.theme
@theme_options = options_for_theme_select
+
if params[:tab].blank?
redirect_to tab: "interface"
end
@@ -141,11 +143,9 @@ class CustomStylesController < ApplicationController
end
def update_themes
- theme = OpenProject::CustomStyles::ColorThemes.themes.find { |t| t[:theme] == params[:theme] }
-
call = ::Design::UpdateDesignService
- .new(theme)
- .call
+ .new(theme_from_params)
+ .call
call.on_success do
flash[:notice] = I18n.t(:notice_successful_update)
@@ -154,11 +154,16 @@ class CustomStylesController < ApplicationController
call.on_failure do
flash[:error] = call.message
end
+
redirect_to custom_style_path
end
private
+ def theme_from_params
+ OpenProject::CustomStyles::ColorThemes.themes.find { |t| t[:theme] == params[:theme] }
+ end
+
def options_for_theme_select
options = OpenProject::CustomStyles::ColorThemes.themes.pluck(:theme)
unless @current_theme.present?
diff --git a/app/views/custom_styles/show.html.erb b/app/views/custom_styles/show.html.erb
index 6884e2487de..633b5a612d4 100644
--- a/app/views/custom_styles/show.html.erb
+++ b/app/views/custom_styles/show.html.erb
@@ -27,12 +27,7 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
-<% tabs = design_tabs %>
-<%=
- render(Admin::DesignHeaderComponent.new(
- tabs: design_tabs,
- ))
-%>
+<%= render(Admin::DesignHeaderComponent.new(tabs: design_tabs)) %>
<%= error_messages_for 'custom_style' %>
<%= form_tag update_design_themes_path, method: :post, class: "form" do %>