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
[#64220] Refactor tab controllers (#19383)
Yauheni Suhakou3aa73e4c2f7a
diff --git a/app/controllers/work_package_types/form_configuration_tab_controller.rb b/app/controllers/work_package_types/form_configuration_tab_controller.rbindex f5c4a2d655f..3edf8c3b1ef 100644--- a/app/controllers/work_package_types/form_configuration_tab_controller.rb+++ b/app/controllers/work_package_types/form_configuration_tab_controller.rb@@ -29,15 +29,11 @@#++module WorkPackageTypes- class FormConfigurationTabController < ApplicationController+ class FormConfigurationTabController < BaseTabControllerinclude PaginationHelperlayout "admin"- before_action :require_admin- before_action :find_type- before_action :assign_tab, only: :update-current_menu_item [:edit, :update] do:typesend@@ -64,10 +60,6 @@ module WorkPackageTypesshow_error_not_found unless @typeend- def assign_tab- params[:tab] = "form_configuration" unless params[:tab]- end-def permitted_type_params# having to call #to_unsafe_h as a query hash the attribute_groups# parameters would otherwise still be an ActiveSupport::Parameterdiff --git a/app/controllers/work_package_types/projects_tab_controller.rb b/app/controllers/work_package_types/projects_tab_controller.rbindex e99c1f54755..54695a4ad7c 100644--- a/app/controllers/work_package_types/projects_tab_controller.rb+++ b/app/controllers/work_package_types/projects_tab_controller.rb@@ -45,7 +45,6 @@ module WorkPackageTypesif result.success?redirect_to edit_type_projects_path(type_id: @type.id), notice: I18n.t(:notice_successful_update)else- params[:tab] = "projects"flash_error(result)load_projectsrender :edit, status: :unprocessable_entity@@ -62,10 +61,6 @@ module WorkPackageTypes@projects = Project.allend- def find_type- @type = ::Type.find(params[:type_id])- end-def permitted_project_params# TODO: once the input is correctly delivered just return: params.expect(type: [:project_ids])diff --git a/app/controllers/work_package_types/settings_tab_controller.rb b/app/controllers/work_package_types/settings_tab_controller.rbindex b67d362f34c..951a6ea4750 100644--- a/app/controllers/work_package_types/settings_tab_controller.rb+++ b/app/controllers/work_package_types/settings_tab_controller.rb@@ -29,12 +29,9 @@#++module WorkPackageTypes- class SettingsTabController < ApplicationController+ class SettingsTabController < BaseTabControllerlayout "admin"- before_action :require_admin- before_action :find_type-current_menu_item %i[edit update] do:typesend@@ -48,17 +45,12 @@ module WorkPackageTypesif result.success?redirect_to edit_type_settings_path(type_id: @type.id), notice: I18n.t(:notice_successful_update)else- params[:tab] = "settings"render :edit, status: :unprocessable_entityendendprivate- def find_type- @type = ::Type.find(params[:type_id])- end-def permitted_settings_paramsparams.expect(type: %i[name color_id description is_milestone is_in_roadmap is_default])end