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

Ensure project dropdown remains visible after validation errors

Aaron Contreras684bd254c3df
diff --git a/modules/boards/app/helpers/boards_helper.rb b/modules/boards/app/helpers/boards_helper.rb
index fdcbf1d6a99..1e6d3669038 100644
--- a/modules/boards/app/helpers/boards_helper.rb
+++ b/modules/boards/app/helpers/boards_helper.rb
@@ -27,6 +27,14 @@ module BoardsHelper
end
def global_board_create_context?
+ global_board_new_action? || global_board_create_action?
+ end
+
+ def global_board_new_action?
request.path == new_work_package_board_path
end
+
+ def global_board_create_action?
+ request.path == work_package_boards_path && @project.nil?
+ end
end
diff --git a/modules/boards/spec/features/boards_global_create_spec.rb b/modules/boards/spec/features/boards_global_create_spec.rb
index 8dd0bcde18f..3fc270b9462 100644
--- a/modules/boards/spec/features/boards_global_create_spec.rb
+++ b/modules/boards/spec/features/boards_global_create_spec.rb
@@ -195,7 +195,9 @@ RSpec.describe 'Boards',
it 'renders a required attribute validation error' do
expect(Boards::Grid.all).to be_empty
- expect(page).to have_text("Project can't be blank.")
+ new_board_page.expect_toast message: "Project #{I18n.t('activerecord.errors.messages.blank')}",
+ type: :error
+ new_board_page.expect_project_dropdown
end
end
end
diff --git a/modules/boards/spec/features/support/board_new_page.rb b/modules/boards/spec/features/support/board_new_page.rb
index 93f2e904e81..6ad950171a4 100644
--- a/modules/boards/spec/features/support/board_new_page.rb
+++ b/modules/boards/spec/features/support/board_new_page.rb
@@ -22,6 +22,10 @@ module Pages
fill_in I18n.t(:label_title), with: title
end
+ def expect_project_dropdown
+ find "[data-qa-selector='project_id']"
+ end
+
def set_project(project)
select_autocomplete(find('[data-qa-selector="project_id"]'),
query: project,