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

feat[Op#50737]: Expand SaveOrCancel form options

Kabiru Mwenjab64417ecaf40
diff --git a/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb b/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
index 36935e62bf8..a11d1c1ecc0 100644
--- a/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
+++ b/modules/storages/app/components/storages/admin/forms/general_info_form_component.html.erb
@@ -19,7 +19,14 @@
end
general_info_row.with_row do
- render(Storages::Admin::SaveOrCancelForm.new(form, storage:))
+ render(
+ Storages::Admin::SaveOrCancelForm.new(
+ form,
+ storage:,
+ cancel_button_path:,
+ cancel_button_should_break_from_frame:
+ )
+ )
end
end
end
diff --git a/modules/storages/app/forms/storages/admin/save_or_cancel_form.rb b/modules/storages/app/forms/storages/admin/save_or_cancel_form.rb
index 47d724deffc..242db77fc64 100644
--- a/modules/storages/app/forms/storages/admin/save_or_cancel_form.rb
+++ b/modules/storages/app/forms/storages/admin/save_or_cancel_form.rb
@@ -36,15 +36,23 @@ module Storages::Admin
button_group.button(name: :cancel,
scheme: :default,
tag: :a,
- href: Rails.application.routes.url_helpers.edit_admin_settings_storage_path(@storage),
- label: I18n.t('button_cancel'))
+ href: @cancel_button_path,
+ label: I18n.t('button_cancel'),
+ target: @cancel_button_target)
end
end
- def initialize(storage:, submit_label: I18n.t('storages.buttons.save_and_continue'))
+ def initialize(
+ storage:,
+ cancel_button_path: nil,
+ cancel_button_should_break_from_frame: false,
+ submit_label: I18n.t('storages.buttons.save_and_continue')
+ )
super()
@storage = storage
@submit_label = submit_label
+ @cancel_button_path = cancel_button_path || Rails.application.routes.url_helpers.edit_admin_settings_storage_path(storage)
+ @cancel_button_target = '_top' if cancel_button_should_break_from_frame
end
end
end