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 "Assignee" boards globally

Aaron Contreras339f9d8d3eb8
diff --git a/modules/boards/app/services/boards/global_create_service.rb b/modules/boards/app/services/boards/global_create_service.rb
index e6d2cc0313a..19404352579 100644
--- a/modules/boards/app/services/boards/global_create_service.rb
+++ b/modules/boards/app/services/boards/global_create_service.rb
@@ -14,6 +14,8 @@ module Boards
end
def before_perform(params, _service_result)
+ return super(params, _service_result) if grid_lacks_query?(params)
+
create_query_result = create_query(params)
super(params.merge(query_id: create_query_result.result.id), create_query_result)
@@ -39,6 +41,10 @@ module Boards
private
+ def grid_lacks_query?(params)
+ %w[assignee].include?(params[:attribute])
+ end
+
def create_query(params)
Queries::CreateService.new(user: User.current)
.call(create_query_params(params))
@@ -62,7 +68,8 @@ module Boards
def query_filters(params)
{
'basic' => [{ manual_sort: { operator: 'ow', values: [] } }],
- 'status' => [{ status_id: { operator: '=', values: [default_status.id] } }]
+ 'status' => [{ status_id: { operator: '=', values: [default_status.id] } }],
+ 'assignee' => []
}.fetch(params[:attribute])
end
@@ -108,7 +115,8 @@ module Boards
"filters" => query_filters(params)
}
)
- ]
+ ],
+ 'assignee' => []
}.fetch(params[:attribute])
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 0c280ec5ee9..5f9ecad5d69 100644
--- a/modules/boards/app/views/boards/boards/_form.html.erb
+++ b/modules/boards/app/views/boards/boards/_form.html.erb
@@ -75,5 +75,13 @@ See COPYRIGHT and LICENSE files for more details.
no_label: true,
container_class: '-wide'%>
</div>
+
+ <div class="form--field">
+ <%= f.label 'attribute', t('boards.board_type_attributes.assignee'), value: 'assignee' %>
+ <%= styled_radio_button_tag 'boards_grid[attribute]',
+ 'assignee',
+ 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 8cc4f00bcf4..6b51c36a430 100644
--- a/modules/boards/spec/features/boards_global_create_spec.rb
+++ b/modules/boards/spec/features/boards_global_create_spec.rb
@@ -79,6 +79,21 @@ RSpec.describe 'Boards',
expect(page).to have_selector("[data-query-name='#{status.name}']")
end
end
+
+ context 'when creating an "Assignee" board' do
+ before do
+ new_board_page.set_board_type 'Assignee'
+ 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"
+ end
+ end
end
end
end