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[Op#50737]: redirect to list page upon automatic management completion

Kabiru Mwenja5ab04a54d028
diff --git a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb
index a69713a023c..82d30866618 100644
--- a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.html.erb
@@ -32,12 +32,8 @@
Storages::Admin::SubmitOrCancelForm.new(
form,
storage:,
- submit_button_options: {
- label: I18n.t("storages.buttons.done_complete_setup")
- },
- cancel_button_options: {
- href: edit_admin_settings_storage_path(storage)
- }
+ submit_button_options:,
+ cancel_button_options:
)
)
end
diff --git a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb
index e8108b22f1b..ff87ef2b36d 100644
--- a/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb
+++ b/modules/storages/app/components/storages/admin/forms/automatically_managed_project_folders_form_component.rb
@@ -41,10 +41,30 @@ module Storages::Admin::Forms
options[:form_url] || default_form_url
end
+ def submit_button_options
+ { label: I18n.t("storages.buttons.done_complete_setup") }.tap do |options_hash|
+ # For create action, break from Turbo Frame and follow full page redirect
+ options_hash[:data] = { turbo: false } if new_record?
+ end
+ end
+
+ def cancel_button_options
+ { href: edit_admin_settings_storage_path(storage) }.tap do |options_hash|
+ if new_record?
+ options_hash[:href] = admin_settings_storages_path
+ options_hash[:target] = '_top'
+ end
+ end
+ end
+
private
def default_form_method
- storage.automatic_management_unspecified? ? :post : :patch
+ new_record? ? :post : :patch
+ end
+
+ def new_record?
+ storage.automatic_management_unspecified?
end
def default_form_url
diff --git a/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb b/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb
index a85bf2f032f..99751e67006 100644
--- a/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb
+++ b/modules/storages/app/controllers/storages/admin/automatically_managed_project_folders_controller.rb
@@ -70,7 +70,8 @@ class Storages::Admin::AutomaticallyManagedProjectFoldersController < Applicatio
service_result = call_update_service
if service_result.success?
- redirect_to edit_admin_settings_storage_path(@storage)
+ flash[:notice] = I18n.t(:notice_successful_create)
+ redirect_to admin_settings_storages_path
else
respond_to { |format| format.turbo_stream }
end