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 ability to create "Parent-child" boards globally

Aaron Contreras825b33b61ca7
diff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rb
index a983bcf8973..3b6e7677ca6 100644
--- a/modules/boards/app/controllers/boards/boards_controller.rb
+++ b/modules/boards/app/controllers/boards/boards_controller.rb
@@ -75,7 +75,8 @@ module ::Boards
'status' => Boards::StatusBoardCreateService,
'assignee' => Boards::AssigneeBoardCreateService,
'version' => Boards::VersionBoardCreateService,
- 'subproject' => Boards::SubprojectBoardCreateService
+ 'subproject' => Boards::SubprojectBoardCreateService,
+ 'subtasks' => Boards::SubtasksBoardCreateService
}.fetch(board_grid_params[:attribute])
end
diff --git a/modules/boards/app/services/boards/subtasks_board_create_service.rb b/modules/boards/app/services/boards/subtasks_board_create_service.rb
new file mode 100644
index 00000000000..7865314a05d
--- /dev/null
+++ b/modules/boards/app/services/boards/subtasks_board_create_service.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Boards
+ class SubtasksBoardCreateService < BaseCreateService
+ private
+
+ def grid_lacks_query?(_params)
+ true
+ end
+
+ def options_for_widgets(_params)
+ []
+ end
+ end
+end
diff --git a/modules/boards/app/views/boards/boards/_form.html.erb b/modules/boards/app/views/boards/boards/_form.html.erb
index 5995a733398..fb8fd545905 100644
--- a/modules/boards/app/views/boards/boards/_form.html.erb
+++ b/modules/boards/app/views/boards/boards/_form.html.erb
@@ -100,5 +100,13 @@ See COPYRIGHT and LICENSE files for more details.
container_class: '-wide'%>
<%= %>
</div>
+
+ <div class="form--field">
+ <%= f.label 'attribute', t('boards.board_type_attributes.subtasks'), value: 'subtasks' %>
+ <%= styled_radio_button_tag 'boards_grid[attribute]',
+ 'subtasks',
+ no_label: true,
+ container_class: '-wide'%>
+ </div>
</div>
</section>
diff --git a/modules/boards/spec/features/boards_global_create_spec.rb b/modules/boards/spec/features/boards_global_create_spec.rb
index fd4948004d6..dad5abfbe3b 100644
--- a/modules/boards/spec/features/boards_global_create_spec.rb
+++ b/modules/boards/spec/features/boards_global_create_spec.rb
@@ -128,7 +128,16 @@ RSpec.describe 'Boards',
expect(page).to have_text "Gotham Renewal Board"
end
end
- it 'creates the board and redirects me to it', :aggregate_failures do
+
+ context 'when creating a "Parent-child" board' do
+ before do
+ new_board_page.set_board_type 'Parent-child'
+ new_board_page.click_on_submit
+
+ wait_for_reload
+ end
+
+ it 'creates the board and redirects me to it' do
expect(page).to have_text(I18n.t(:notice_successful_create))
expect(page).to have_current_path("/projects/#{project.identifier}/boards/#{Boards::Grid.last.id}")
expect(page).to have_text "Gotham Renewal Board"