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

Add `POST /projects/:project_id/boards` route

Aaron Contreras625b14504137
diff --git a/modules/boards/config/routes.rb b/modules/boards/config/routes.rb
index 1985729da31..90c46cb5ee1 100644
--- a/modules/boards/config/routes.rb
+++ b/modules/boards/config/routes.rb
@@ -16,6 +16,10 @@ OpenProject::Application.routes.draw do
only: %i[new],
as: :work_package_boards
+ # Adding the `create` action into the above `resources` macro would
+ # result in a name collision between it and `get /boards(/*state)`
+ # as it would result in both being named `project_work_package_boards`
+ post '/boards', to: 'boards/boards#create'
get '/boards(/*state)', to: 'boards/boards#index', as: :work_package_boards
end
end
diff --git a/modules/boards/spec/routing/boards_routing_spec.rb b/modules/boards/spec/routing/boards_routing_spec.rb
index a95ef54d3aa..06f991d1885 100644
--- a/modules/boards/spec/routing/boards_routing_spec.rb
+++ b/modules/boards/spec/routing/boards_routing_spec.rb
@@ -59,6 +59,12 @@ RSpec.describe 'Boards routing' do
.to(controller: 'boards/boards', action: 'new')
end
+ it do
+ expect(subject)
+ .to route(:post, '/projects/foobar/boards')
+ .to(controller: 'boards/boards', action: 'create', project_id: 'foobar')
+ end
+
it do
expect(subject)
.to route(:post, '/boards')