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

chore[#47147]: Add `Cancel` button in project storage form

Kabiru Mwenja8bec37e789e5
diff --git a/modules/storages/app/views/storages/project_settings/_form.html.erb b/modules/storages/app/views/storages/project_settings/_form.html.erb
index c53b9290cfb..dcd07597d00 100644
--- a/modules/storages/app/views/storages/project_settings/_form.html.erb
+++ b/modules/storages/app/views/storages/project_settings/_form.html.erb
@@ -48,6 +48,7 @@
<div class="form--field">
<%= styled_button_tag submit_button_label, class: "-highlight -with-icon icon-checkmark" %>
+ <%= link_to t(:button_cancel), project_settings_projects_storages_path(@project), class: 'button -with-icon icon-cancel' %>
</div>
<%= nonced_javascript_tag do -%>
diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rb
index f2a427d2529..6b58635ea9c 100644
--- a/modules/storages/spec/features/manage_project_storage_spec.rb
+++ b/modules/storages/spec/features/manage_project_storage_spec.rb
@@ -65,7 +65,14 @@ describe 'Activation of storages in projects', js: true do
expect(page).to have_text(I18n.t('storages.no_results'))
page.find('.toolbar .button--icon.icon-add').click
+ # Can cancel the creation of a new file storage
+ expect(page).to have_current_path new_project_settings_projects_storage_path(project_id: project)
+ expect(page).to have_text('Add a file storage')
+ page.click_link('Cancel')
+ expect(page).to have_current_path project_settings_projects_storages_path(project)
+
# Enable one file storage together with a project folder mode
+ page.find('.toolbar .button--icon.icon-add').click
expect(page).to have_current_path new_project_settings_projects_storage_path(project_id: project)
expect(page).to have_text('Add a file storage')
page.find_by_id('storages_project_storage_project_folder_mode_manual').click
@@ -95,6 +102,14 @@ describe 'Activation of storages in projects', js: true do
expect(page).to have_text('File storages available in this project')
expect(page).to have_text('Storage 1')
+ # Click Edit icon again but cancel the edit
+ page.find('.icon.icon-edit').click
+ expect(page).to have_current_path edit_project_settings_projects_storage_path(project_id: project,
+ id: Storages::ProjectStorage.last)
+ expect(page).to have_text('Edit the file storage to this project')
+ page.click_link('Cancel')
+ expect(page).to have_current_path project_settings_projects_storages_path(project)
+
# Press Delete icon to remove the storage from the project
page.find('.icon.icon-delete').click
alert_text = page.driver.browser.switch_to.alert.text